Thursday, February 17, 2011

Decision Making and Branching

Admission to a professional course is subject to the following conditions:
(a) Marks is Mathematics >= 60
(b) Marks in Physics >= 50
(c) Marks in Chemistry >= 40
(d) Total in all three subjects >= 200
or
Total in Mathematics and Physics >=150
Given the marks in the three subjects, write a program to process the application to list the eligible candidates.

#include <stdio.h>
void main()
{
int m,p,c,t,mp;
clrscr();
printf("Enter the marks of Maths, Physics and Chemistry:");
scanf("%d %d %d",&m,&p,&c);
t=m+p+c;
mp=m+p;
if(m>=60&&p>=50&&c>=40)
printf("Candidate is eligible!");
else if(t>=200)
printf("Candidate is eligible!");
else if(mp>=150)
printf("Candidate is eligible!");
else
printf("Candidate is not eligible!");
getch();
}

No comments:

Post a Comment