# Define Structure Consisting of Following Elements 1. Student Roll_No 2. Student Name 3. Student Percentage Write a Program to Read Records of 5 Students of and Display Same. - Structured Programming Approach

Define structure consisting of following elements
1. student roll_no
2. student name
3. student percentage
Write a program to read records of 5 students of and display same.

#### Solution

• The Structure for above given elements can be defined as :

struct student
{
char stud_name[20];
int roll_no;
int percentage;
};
Program:
#include<conio.h>
#include<stdio.h>
struct student
{
char stud_name[20];
int roll_no;
int percentage;
};
void main ()
{
struct student st[100];
int n,i,j;
clrscr();
for(i=0;i<=4;i++)
{
printf("Enter the student's name, roll number and percentage:");
scanf("%s %d %d" , st[i].stud_name,&st[i].roll_no,&st[i].percentage);
}
printf("Name\tRoll No\tpercentage\n");
printf("----------------------------------------------\n");
for(i=0;i<=4;i++)
{
printf("%s\t%d\t%d\n",st[i].stud_name, st[i].roll_no, st[i].percentage);
}
getch();
}
 Output: Enter the student's name, roll number and percentage: ketan0190Enter the student's name, roll number and percentage: carry0291Enter the student's name, roll number and percentage: tom0392Enter the student's name, roll number and percentage: jerry0495Enter the student's name, roll number and percentage: bob0596Name Roll No Percentage------------------------------------------------------ketan 01 90carry 02 91tom 03 92jerry 04 95bob 05 96
Is there an error in this question or solution?