You are on page 1of 3

Structure

Source code

#include<iostream.h>

struct student

int rollno;

float per;

char name[10];

};

void main()

int n,i;

struct student s[100];

printf("\nEnter number of students:");

scanf("%d",&n);

printf("\nEnter details");

for(i=0;i<n;i++)

printf("\nEnter roll number:");

scanf("%d",&s[i].rollno);

printf("\nEnter name:");
scanf("%s",s[i].name);

printf("\nEnter Percentage:");

scanf("%f",&s[i].per);

printf("\n-----------------Students details-------------------------------");

for(i=0;i<n;i++)

printf("\nRoll number:%d",s[i].rollno);

printf("\nName:%s",s[i].name);

printf("\nPercentage:%f",s[i].per);

OUTPUT:

You might also like