Student details (structure)

C program to accept and display student details using structure :

code

#include<stdio.h>
#include<conio.h>
struct stud
{
int roll_no;
char name[50];
float per;
};
void main()
{
struct stud s;
clrscr();
printf(“Enter roll no. of student :”);
scanf(“%d”,&s.roll_no);
printf(“\nEnter studdent name :”);

scanf(“%s”,s.name);
printf(“\nEnter student percentage :”);

scanf(“%f”,&s.per);
printf(“\nStudent details :”);
printf(“\nStudent roll number :%d”,s.roll_no);
printf(“\nName of student :%s”,s.name);
printf(“\nStudent percentage :%f”,s.per);
getch();
}

 


output

Enter roll no. of student :35

Enter studdent name :Victor

Enter student percentage :45

Student details :

Student roll number :35

Name of student :Victor

Student percentage :45.00

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s