Code:
//For turbo C++ remove below comments
#include <stdio.h>
//#include<conio.h>
struct student
{
char person_name[100];
char branch[100];
int total_marks;
} s[10];
void main()
{
// clrscr();
int i, n = 10;
for (i = 0; i < n; i++)
{
printf("\nFor student %d\n", i + 1);
printf("Enter Name : ");
scanf("%s", &s[i].person_name);
printf("Enter Branch : ");
scanf("%s", &s[i].branch);
printf("Enter total marks : ");
scanf("%d", &s[i].total_marks);
}
printf("\nData of Students :\n");
for (i = 0; i < n; i++)
{
printf("For student %d\n",i+1);
printf("Name : %s\n", s[i].person_name);
printf("Branch : %s\n", s[i].branch);
printf("Total marks : %d\n", s[i].total_marks);
}
// getch();
}
Comments
Post a Comment