Write a program to create a structure which will store name, roll and marks of 6 courses that you obtained. This structure will also store the total obtained marks. Which you can obtain by summing all the marks. Store all the data for 10 students. Print the name, roll and total obtained marks of each student.
#include<stdio.h>
#include<conio.h>
struct student
{
char name[30];
int roll,bangla,english,math,computer,fundamental,physics,total_m;
};
main()
{
clrscr();
struct student result[10];
int i;
for(i=0;i<10;i++)
{
printf("Enter Name:= ");
scanf("%s",result[i].name);
printf("Enter roll:= ");
scanf("%d",&result[i].roll);
printf("Enter Bangla Marks:= ");
scanf("%d",&result[i].bangla);
printf("Enter English Marks:= ");
scanf("%d",&result[i].english);
printf("Enter Math Marks:= ");
scanf("%d",&result[i].math);
printf("Enter comuter Marks:= ");
scanf("%d",&result[i].computer);
printf("Enter fundamenta Marks:= ");
scanf("%d",&result[i].fundamental);
printf("Enter Phusics Marks:= ");
scanf("%d",&result[i].physics);
result[i].total_m = result[i].bangla + result[i].english + result[i].math + result[i].computer + result[i].fundamental + result[i].physics;
}
clrscr();
for(i=0;i<10;i++)
{
printf("%s---",result[i].name);
printf("%d---",result[i].roll);
printf("%d\n",result[i].total_m);
}
getch();
}
#include<conio.h>
struct student
{
char name[30];
int roll,bangla,english,math,computer,fundamental,physics,total_m;
};
main()
{
clrscr();
struct student result[10];
int i;
for(i=0;i<10;i++)
{
printf("Enter Name:= ");
scanf("%s",result[i].name);
printf("Enter roll:= ");
scanf("%d",&result[i].roll);
printf("Enter Bangla Marks:= ");
scanf("%d",&result[i].bangla);
printf("Enter English Marks:= ");
scanf("%d",&result[i].english);
printf("Enter Math Marks:= ");
scanf("%d",&result[i].math);
printf("Enter comuter Marks:= ");
scanf("%d",&result[i].computer);
printf("Enter fundamenta Marks:= ");
scanf("%d",&result[i].fundamental);
printf("Enter Phusics Marks:= ");
scanf("%d",&result[i].physics);
result[i].total_m = result[i].bangla + result[i].english + result[i].math + result[i].computer + result[i].fundamental + result[i].physics;
}
clrscr();
for(i=0;i<10;i++)
{
printf("%s---",result[i].name);
printf("%d---",result[i].roll);
printf("%d\n",result[i].total_m);
}
getch();
}