Write a simple C program that accepts user input for the following:
Total number of test items, and percentage of correct answers. For every correct answer a
student gets five (5) points and loses two (2) points for every wrong answer.
#include <stdio.h>
int main()
{
int n,c;
printf("Enter total number of items: ");
scanf("%d",&n);
printf("Enter the percentage of correct answers: ");
scanf("%d",&c);
int points=c*5;
int loss=(n-c)*2;
printf("Total earned points are: ");
printf("%d",points);
printf("\n");
printf("Total points lossed are: ");
printf("%d",loss);
return 0;
}
Comments
Leave a comment