C File =>
/* Write a program to create student structure having fields roll no,
name. Accept details of one student and write a function to
display the details. */
#include<stdio.h>
typedef struct Student
{
int rno;
char name[30];
float perc;
};
int main()
{
struct Student s;
printf("\n Enter Roll Number : ");
scanf("%d",&s.rno);
printf("\n Enter Student name : ");
scanf("%[^\n]s",s.name);
printf("\nEnter Percentage : ");
scanf("%f",&s.perc);
printf("\n\n Details of Student are :\n");
printf("\n Roll Number is : %d",s.rno);
printf("\n Name is : %s",s.name);
printf("\n Percentage : %f",s.perc);
return 0;
}
Comments
Post a Comment
Please do not enter any spam link in message.