struct student
{
char name[20];
int roll;
int marks;
float sum;
} s[10];
int main()
{
int i,j;
float sum = 0.0;
printf("Enter information of students:\n");
// storing information
for(i=0; i<10; ++i)
{
s[i].roll = i+1;
printf("\nFor roll number%d,\n",s[i].roll);
printf("Enter name: ");
scanf("%c",s[i].name);
printf("Enter marks: ");
scanf("%f",&s[i].marks);
printf("\n");
}
for (j = 0; j <= s[i].marks; j++)
{
sum=sum+1;
}
printf("Displaying Information:\n\n");
// displaying information
for(i=0; i<10; ++i)
{
printf("\nRoll number: %d\n",i+1);
printf("Name: ");
puts(s[i].name);
printf("Marks: %.1f",s[i].marks);
printf("sum of ur marks is %f", sum);
printf("\n");
}
return 0;
}
0 comments:
Post a Comment