Problem Description
write a program to read and display the information of all the students in the class. THen edit the details of i the student and redisplay the entire information
Input and Output Format:
Refer sample input and output for formatting specification.
All float values are displayed correct to 2 decimal places.
All text in bold corresponds to input and the rest corresponds to output.- CODING ARENA
- #include <stdio.h>
- struct student
- {
- int rollno;
- char name[20];
- int dd;
- char mm[10];
- int fees;
- }s[10];
- int main()
- {
- int i,n;
- scanf("%d",&n);
- for(i=0;i<n;i++)
- {
- scanf("%d",&s[i].rollno);
- scanf("%s",s[i].name);
- scanf("%d%s",&s[i].dd,s[i].mm);
- scanf("%d",&s[i].fees);
- }
- for(i=0;i<n;i++)
- {
- printf("Roll no:%d\n",s[i].rollno);
- printf("Name:%s\n",s[i].name);
- printf("DOB:%.02d%s\n",s[i].dd,s[i].mm);
- printf("Fees:%d\n",s[i].fees);
- }
- return 0;
- }
Test Case 1
Input (stdin)2 1101 Ramesh 25dec1990 15000 1102 Suresh 09sep1989 30000
Expected OutputRoll no:1101 Name:Ramesh DOB:25dec1990 Fees:15000 Roll no:1102 Name:Suresh DOB:09sep1989 Fees:30000
Test Case 2
Input (stdin)3 1101 Ramesh 25dec1990 15000 1102 Suresh 09sep1989 30000 1103 Ganesh 12oct2011 40000
Expected OutputRoll no:1101 Name:Ramesh DOB:25dec1990 Fees:15000 Roll no:1102 Name:Suresh DOB:09sep1989 Fees:30000 Roll no:1103 Name:Ganesh DOB:12oct2011 Fees:40000
No comments:
Post a Comment