Posts

Showing posts with the label Find Total of Marks

My Subject Blog

C program to Find Total of Marks using Structure

/* Write a function to enter Roll no, marks of the three subject for 3 students and find total obtained by each student. */ #include <stdio.h> struct student { int rollno; int marks[3]; }s[3]; int main(void)  { int i,j,total=0; for(i=0;i<3;i++) { total=0; printf("Enter Roll No : "); scanf("%d",&s[i].rollno); for(j=0;j<3;j++) { printf("Enter Marks for Subject [%d]",j+1); scanf("%d",&s[i].marks[j]); total=total+s[i].marks[j]; } printf("\n Total Marks of Student Roll No [%d] : %d",s[i].rollno,total); } return 0; }

Followers