Sunday, 20 May 2012

Write a program in C that reads & displays the information of a student using structure.


        struct student
{
char name[10];
int roll;
float age;
}s;
struct student s;
main()
{
printf("Enter the name, rall no., and age of a student ");
scanf("%s%d%f",s.name,&s.rall,&s.age);
printf("The name of the student is %s and his roll no. is %d and  he is %f years old ", s.name,s.roll,s.age);
getch();
}
Output
Enter the name, roll no., and age of a student amit 243 18
        The name of the student is amit and his roll no. is 243 and he is 18 years old

No comments:

Post a Comment