Structure in C.

01  #include <stdio.h>
02
03 struct student
04 {
05 char name[30];
06 int roll_no;
07 float fees;
08 };
09
10 int main()
11 {
12
13 struct student s;
14
15 printf("Enter Student's name roll no. & fees :");
16 gets(s.name);
17 scanf("%d",&s.roll_no);
18 scanf("%f",&s.fees);
19
20 printf("nStudent Details :");
21 printf("nName : %s",s.name);
22 printf("nRoll No. : %d",s.roll_no);
23 printf("nFees. : %f",s.fees);
24
25 return 0;
26 }
 
 OUTPUT :

Enter Student's name roll no. & fees :Shiv
123
4300

Student Details :
Name : Shiv
Roll No. : 123
Fees. : 4300.000000

Related Post

Leave a Reply

Your email address will not be published. Required fields are marked *