#include <stdio.h> #include <stdlib.h> #include <conio.h> int main() { char a,b; int x=1,correct=0,incorrect=0,unattempted=0; printf("Enter Answer for Q.%d: ",x); scanf("%c",&a); x++; switch(a) { case 'A': printf("Correct \n"); correct++; break; case 'U': unattempted++; break; default: printf("Wrong \n"); incorrect++; break; } printf("Enter Answer for Q.2:"); scanf("%c",&b); x++; switch(b) { case 'A': printf("Correct \n"); correct++; break; default: printf("Wrong \n"); incorrect++; break; } printf("Correct = %d ; Incorrect = %d ; Unattempted = %d",correct,incorrect,unattempted); return 0; }
Enter Answer for Q.1: A Correct Enter Answer for Q.2:Wrong Correct = 1 ; Incorrect = 1 ; Unattempted = 0 Process returned 0 (0x0) execution time : 2.281 s Press any key to continue.
main
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)