#include<stdio.h>
#include<conio.h>
void main()
{
typedef struct
{
char sname[10];
int rollno;
char cname[10];
}student;
student sarr[3];
int i;
clrscr();
for(i=0;i<3;i++)
{
printf("\nEnter name and class of student no %d",i+1);
scanf("%s%s",sarr[i].sname,sarr[i].cname);
printf("Enter the roll no\n");
scanf("%d",&sarr[i].rollno);
}
printf("\n Student Detail's\n");
printf("\nSname\tCname\tRollNo\n");
for(i=0;i<3;i++)
{
printf("%s\t%s\t",sarr[i].sname,sarr[i].cname);
printf("%d\n",sarr[i].rollno);
}
getch();
}
OUTPUT:

#include<conio.h>
void main()
{
typedef struct
{
char sname[10];
int rollno;
char cname[10];
}student;
student sarr[3];
int i;
clrscr();
for(i=0;i<3;i++)
{
printf("\nEnter name and class of student no %d",i+1);
scanf("%s%s",sarr[i].sname,sarr[i].cname);
printf("Enter the roll no\n");
scanf("%d",&sarr[i].rollno);
}
printf("\n Student Detail's\n");
printf("\nSname\tCname\tRollNo\n");
for(i=0;i<3;i++)
{
printf("%s\t%s\t",sarr[i].sname,sarr[i].cname);
printf("%d\n",sarr[i].rollno);
}
getch();
}
OUTPUT:
Enter name and class of student no 1 Tushar
first
Enter the roll no
1
Enter name and class of student no 1 Kamal
Second
Enter the roll no
2
Enter name and class of student no 1 Rahul
Third
Enter the roll no
3
Student Detail's
Sname Cname RollNo
Tushar First 1
Kamal Second 2
Rahul Third 3
No comments:
Post a Comment