Description: A university has the following rules for a student to qualify for a degree with A as the
main subject and B as the subsidiary subject:
#include<conio.h>
int main()
{
int pera,perb;
printf("Enter percentage of A and B: ");
scanf("%d%d",&pera,&perb);
if(pera>=55&&perb>=45)
printf("\n Student is passed");
else if(pera>=45&&pera<55&&perb>=55)
printf("\n Student is passed");
else if(perb<45&&pera>=65)
printf("Student is allowed to reappear in an exam");
else
printf("Student is failed");
printf ("\n\nPress any key to close.");
getch ();
return 0;
}
main subject and B as the subsidiary subject:
- He should get 55 percent or more in A and 45 percent or more in B.
- If he gets than 55 percent in A he should get 55 percent or more in B. However, he should get at least 45 percent in A.
- If he gets less than 45 percent in B and 65 percent or more in A he is allowed to reappear in an examination in B to qualify.
- In all other cases he is declared to have failed.
Code
#include<stdio.h>#include<conio.h>
int main()
{
int pera,perb;
printf("Enter percentage of A and B: ");
scanf("%d%d",&pera,&perb);
if(pera>=55&&perb>=45)
printf("\n Student is passed");
else if(pera>=45&&pera<55&&perb>=55)
printf("\n Student is passed");
else if(perb<45&&pera>=65)
printf("Student is allowed to reappear in an exam");
else
printf("Student is failed");
printf ("\n\nPress any key to close.");
getch ();
return 0;
}
No comments :
Post a Comment
Note: Only a member of this blog may post a comment.