Home »
Chapter3 C program
» Program to print division of a person.[Note: A person gets Distinction if s/he score 80% or above, First Division if s/he below 80% and above 60% , similarly 50% or above will be Second and if 32% and above will be Third division]
Program to print division of a person.[Note: A person gets Distinction if s/he score 80% or above, First Division if s/he below 80% and above 60% , similarly 50% or above will be Second and if 32% and above will be Third division]
Explanation
Here, per stores float percentage. It has been checked and if it is above 100 or below 31 it will print invalid that is stated in else statement at line 16. Nested if statement is used here so if the "per" value is less or equal to 100 and if per is above 31 it enters inside and is checked with value 80,60,50 to print distinction, first and second division respectively and for third division,it will be sure if the above condition is false.
No comments:
Post a Comment
If you have any doubt, let me know...