Write a program that define a structure student, with members rollno, name and marks. Also define functions to input and show student data.

#include<stdio.h>
struct student
{
int roll_no;
char name[20];
float marks;
};
struct student input();
void display(struct student);
void main()
{
struct student r;
clrscr();
r=input();
display(r);
getch();
}
struct student input()
{
struct student s1;
printf(“Enter student datan”);
scanf(“%d”,&s1.roll_no);
fflush(stdin);
gets(s1.name);
scanf(“%f”,&s1.marks);
return(s1);
}
void display(struct student s)
{
printf(“roll_no=%dn”,s.roll_no);
printf(“name=%sn”,s.name);
printf(“marks=%fn”,s.marks);
}

One thought on “Write a program that define a structure student, with members rollno, name and marks. Also define functions to input and show student data.

Leave a Reply

Your email address will not be published.