Write a simple C program that accepts user input for the following:
The total number of test items, and the 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 x,m;
printf("Input total number of items: ");
scanf("%d",&x);
printf("Enter the percentage of correct answers: ");
scanf("%d",&m);
int P=m*5;
int L=(x-m)*2;
printf("Total earned points are: ");
printf("%d",P);
printf("\n");
printf("Total points lossed are: ");
printf("%d",L);
return 0;
}
Comments
Leave a comment