Write a program to read name rollno. Mark in 5 subject of a student and display name, Percentage and division of a student?
Add caption |
include<stdio.h>
include<conio.h>
Struct S {
Char
name [50];
Int
rollno;
Float
m[5];
};
Main()
{
FILE
Struct
s stud;
Float
per tot=0;
printf(“Enter name”);
printf(“Enter name”);
gets(stu.name);
printf(“Enter
rollno”);
scanf(“%d”,
& stu.rollno);
for(i=o;
i<5; i++)
{
Printf(“\n Enter %d Subject Mark”, i+1);
Scanf(“%f”,
& stud.m[i]);
Tot=tot+stud.mark[i];
}
/* Display */
Printf(“\n name =%s”, Stud.name);
Printf(“\n Percentage=%f “, per);
If(per>=75)
Printf(“Distinction”);
Else if (per>=65)
Printf(“1st
Division”);
Else if(per>=50)
Printf(“2nd
Division”);
Else
Printf(“Fail”);
Getch();
}
No comments:
Post a Comment