Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The goal of this exercise is to help you practice the simple C programming including functions, loops and if statements. In this exercise, you will

The goal of this exercise is to help you practice the simple C programming including functions, loops and if statements.

In this exercise, you will write two functions that will:

  • calculate whether a number is prime
  • convert a course grade into a GPV (Grade point value)

image text in transcribed

image text in transcribed

The goal of this exercise is to help you practice the simple C programming including functions, loops and if statements. In this exercise, you will write two functions that will: calculate whether a number is prime convert a course grade into a GPV (Grade point value) is_prime() is a function that takes in a single integer as input and returns 1 if the input is a prime number and 0 otherwise. calculate_gpvo is a function that converts a percentage grade score to a grade point value. Download Starter Code: ex1.c What to do: Implement the functions as needed. Add helper functions if you want to make your code clearer. Test your code on your own inputs What NOT to do: Import any extra libraries Change the name of any functions in the starter code Change or remove the #ifndef __testing__ and #endif lines #include // NO additional imports allowed. You *can* make helper functions if you wish. // int is_prime(int check_val) { /** * If `check_val is a positive prime number (e.g., 2, 3, 5, 7, 11, etc) * return 1, otherwise return 0 */ return -1; // Replace this } float calculate_gpv(int grade) { * Given grade as a percentage course grade, return the corresponding grade * point value as calculated by the University of Toronto grading scheme * (https://www.utsc.utoronto.ca/registrar/u-t-grading-scheme) * if grade is not a valid grade, return -1 */ return 0.0; }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions