program to make a students file and prints the name ,class and roll number in c-programming.
program to takes the students name , class and roll by the user and prints them by using structure in c-programming languages.
#include<stdio.h>
#include<conio.h>
struct student
{
char name[20];
int roll;
int classes;
};
struct student input()
{
struct student b;
printf("enter the name of student,roll and class:-");
gets(b.name);
fflush(stdin);
scanf("%d",&b.roll);
scanf("%d",&b.classes);
return(b);
}
void display(struct student s)
{
printf("\n name:-%s roll:-%d class:-%d",s.name,s.roll,s.classes);
}
void main()
{
struct student b1;
b1=input();
display(b1);
getch();
}
#include<conio.h>
struct student
{
char name[20];
int roll;
int classes;
};
struct student input()
{
struct student b;
printf("enter the name of student,roll and class:-");
gets(b.name);
fflush(stdin);
scanf("%d",&b.roll);
scanf("%d",&b.classes);
return(b);
}
void display(struct student s)
{
printf("\n name:-%s roll:-%d class:-%d",s.name,s.roll,s.classes);
}
void main()
{
struct student b1;
b1=input();
display(b1);
getch();
}
output:-
For more c-programming:-

No comments:
Post a Comment