A Student
in a class is appreciated based on the following factors:
Number of
'S' grade in the subjects learnt >= 3
Percentage
of Attendance >= 90
Participation
in sports activity in a semester >= 2
Appreciation
is given as follows:
(i) 'Excellent'
if all three conditions are met
(ii)'Very
Good' if conditions (i) and (ii) are met
(iii)'Good'
if conditions (i) and (iii) are met
Given the
Number of 'S' grades, Attendance and Participation in sports activity in a
semester, write an algorithm and the subsequent 'C' program to output the
appreciation for the student.
Input
Format:
First
line contains the number of 'S' grade
Next line
contains the percentage of Attendance of the student
Next line
contains the number participation in sports activity by the student in the
current semester
Output
Format:
Print the
Appreciation for the student
Program:
#include<stdio.h>
void main()
{
int s_grade, attendance, sports;
scanf("%d%d%d", &s_grade, &attendance, &sports);
if (s_grade >= 3 && attendance >= 90 && sports >= 2)
printf("Excellent");
else if (s_grade >= 3 && attendance >= 90)
printf("Very good");
else if (s_grade >= 3 && sports >= 2)
printf("Good");
}
Algorithm:
Step1. get the number of s grades, attendance in the subjects and the number of sports activities that the person participated in.
Step2. if the inputs satisfy the all the criteria then display excellent.
Step3. if the inputs satisfy criteria i,ii then display very good.
Step4. if the inputs satisfy criteria i,iii then display good.
Step5. End
No comments:
Post a Comment