Student marks by using structures

 

#include <stdio.h>
struct student
{
char name [30];
int marks[ 5];
int total;
};
int main()
{
struct student std;
int i;
printf("Enter name: ");
gets(std.name);
printf("Enter marks:\n");
std.total=0;
for(i=0;i< 5;i++){
printf("Marks in subject %d: ",i+1);
scanf("%d",&std.marks[i]);
std.total+=std.marks[i];
}
return 0;
}

Result

Write a C program to calculate percentage of student using structure
Write a C program to

Comments

Popular posts from this blog

C program to copy the contents of one file to another

Division of two complex numbers