Wednesday, 22 February 2017

Class Representative

QUESTION DESCRIPTION :

A student is eligible to be a class representative if his or her attendance % and marks is greater that 90% and he or she doesnt have any arrears. Given the attendance % ,mark % and number of arrears, write a C program to determine whether a student is eligible to be a Class Representative or not.

Input format:
Input consists of 2 float and an integer. The first float corresponds to the attendance % and the second float corresponds to the percentage of marks. The third input is an integer which corresponds to the number of arrears.

Output format :
Output consists of the string "Eligible " or "Not Eligible"
Refer sample input and output for further formatting specifications.


TEST CASE 1

INPUT

90.1
90.1
0 

OUTPUT

Eligible
 

TEST CASE 2

INPUT

90.0
90.0
0

OUTPUT

Not Eligible


EXPLANATION :

The code requires you to accept 2 float inputs corresponding to attendance % , marks % and  an integer corresponding to the number of arrears he/she has in exams.

The result will be Eligible or Not Eligible , depending on the conditions mentioned above ( attendance and exam % >90 and arrears=0  , then the person is eligible ) 


ALGORITHM :

  • Accept 3 numbers from the user , first two are float and the last one is integer ( a,m,ar )
  • Check for eligibility for being the Class representative ( (a>90.0)&&(m>90.0)&&ar==0 )
  • If the above test case is true , print Eligible
  • If the above test case is not true , print Not Eligible
#Caution : Person with 90.0 % is not eligible , %age should be grater than 90.0
 
SOLUTION : (Please use this as reference only)
 
CODE
 

No comments:

Post a Comment