Write a Program in C to implement Structure with Array
#include<stdio.h>#include<conio.h>
struct student
{
int roll;
char name;
int maths;
};
void main()
{
struct student s[4];
int i;
clrscr();
printf("Enter Roll Number, First Character of Name and Marks\n");
for(i=0;i<=3;i++)
{
printf("\nInformation for student %d\n",i+1);
scanf("%d %c %d",&s[i].roll,&s[i].name,&s[i].maths);
}
printf("\n\nRoll Number \t Names \t\t Marks\n\n");
for(i=0;i<=3;i++)
{
printf(" %d \t %c \t\t %d\n",s[i].roll,s[i].name,s[i].maths);
}
getch();
}
No comments:
Post a Comment