In this example you are allowed to use from the C standard library only functions for input and output (e.g. printf(), scanf())
Complete the following function using C programming language:
Complete the function intQ3(floatQ3_input) that takes a student’s average as an input, which is a floating-point value, and returns:
#include <stdio.h> int intQ3(float Q3_input){ if(Q3_input>=0 && Q3_input<=100){ if(Q3_input>=90){ return 4; } else if(Q3_input>=80){ return 3; } else if(Q3_input>=70){ return 2; } else if(Q3_input>=60){ return 1; } else { return 0; } } else{ return -1; } } int main() { float average; printf("Enter average: "); scanf("%f",&average); printf("Result: %d\n",intQ3(average)); return 0; }
Get Answers For Free
Most questions answered within 1 hours.