APC-S-014.c ​
Metadata ​
- Author — Amit Dutta (amitdutta4255@gmail.com)
- Last updated — 14 Jan 2026
- License — MIT
Problem Statement ​
Problem Statement
Write a program to store roll no, name and marks of 5 students then print it. use structure
Source Code ​
Printing the code
To print this file, open it on GitHub and click Raw before printing, or use the Download Raw button above and print directly from that page.
c
#include <stdio.h>
#include <string.h>
struct student
{
int roll_no;
char name[30];
float marks;
};
int main()
{
int i, stu_count = 3;
struct student s[stu_count];
for (i = 0; i < stu_count; i++)
{
printf("\nEnter the Roll Number: ");
scanf("%d", &s[i].roll_no);
getchar();
printf("Enter the name: ");
gets(s[i].name);
printf("Enter the Marks: ");
scanf("%f", &s[i].marks);
}
printf("\n%-10s %-20s %-10s\n", "ROLL", "NAME", "MARKS");
printf("%-10s %-20s %-10s\n", "====", "====", "=====");
for (i = 0; i < stu_count; i++)
{
printf("%-10d %-20s %-10.2f\n", s[i].roll_no, s[i].name, s[i].marks);
}
return 0;
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32