write a program to print message if percentage greater than equal to 75 percentage else not admitted
Answers
Explanation:
very hard questions...
Answer:
Write a program for the following question
preeti.priyadarsini
A student will not be allowed to sit in the exam if his/her attendance is less than 75%. The student will be only allowed to sit if he/she has a medical cause. Ask the user if he/she has a medical cause (Y or N). Take the following input from the user:
No. of classes held
No. of classes attended
Print % of classes attended and if the student is allowed to sit in the exam or not. Print accordingly.
Answers
#include <stdio.h>
int main() {
printf("The mimimum attendance for giving the examination is 75 percent. \n");
printf("enter details to check eligibility:\n");
float a, b;
printf("enter the total no. of classes held.\n");
scanf("%f", &a);
printf("enter the no. of classes attended.\n");
scanf("%f", &b);
if((b/a) * 100 < 75) {
printf("your attendance is less than 75%.\n");
char c;
printf("Do you have a medical cause? 'Y' for yes and 'N' for no.\n");
scanf(" %ch", &c);
switch(c) {
case 'Y':
printf("you are eligible for giving the examinations.");
break;
case 'N':
printf("sorry, you are not eligible for giving the examinations.");
break;
default:
printf("Invalid input.");
}
} else {
printf("you are eligible for giving the examinations.");
}
return 0;