a. Marks in math>=60
b. Marks in physics>=50
c. Marks in chemistry>=40
d. Total in all three subjects>=200
or
Total in math and physics>=150
Given the marks in the three subjects, write a program to process the application to list the eligible candidates.
Algorithm Development :
Step
1 : Start
Step
2 : Read marks of math,physics,chemistry
Step
3 : Calculate total (math+physics+chemistry)
Step 4 : If math>=60
and physics>=50 and chemistry>=40 and total>=200 OR
physics+chemistry>=150
display
"Eligible Candidate"
Step4
: else display "Not Eligible "
Step6:
End
Flowcharting :
Soln : Code goes like this :
/* Checking the eligibility of applicant's by the entered marks */
#include<stdio.h>
int main()
{
int math, physics, chemistry,total;
printf("\ Enter marks of math, physics, chemistry : ");
scanf("%d %d %d",&math,&physics,&chemistry);
total=math+physics+chemistry;
if(math>=60 && physics>=50 && chemistry>=40 && total>=200 || (math+physics)>=150)
{
printf("\n Eligible Applicant");
}
else
{
printf("\n Not Eligible");
}
return 0;
}
Output:
Output1:
Output 2:
I have used Dev CPP to compile this program.
If you are using Turbo C++ IDE, then use conio.h in link section after stdio.h
and use getch(); to hold the output screen, just before the end of main function.
If you have any confusion regarding the program, please, comment below.
Happy Coding !
Thank you
0 comments:
Post a Comment