google.com, pub-6167773875660516, DIRECT, f08c47fec0942fa0 Write a program in c to display student data using structure - 2nd puc computer science

Write a program in c to display student data using structure

Write a program in c to display student data using structure

#include<stdio.h>

#include<conio.h>

void main()

{

struct student

{

int rollno;

char name[20];

char combination[4];

float percentage;

};

struct student s1;

clrscr();

printf("Enter the roll number: ");

scanf("%d",&s1.rollno);

printf("Enter the name of the student: ");

scanf("%s",s1.name);

printf("Enter the combination: ");

scanf("%s",s1.combination);

printf("Enter the percentage: ");

scanf("%f",&s1.percentage);

printf("Roll number=%d\n",s1.rollno);

printf("Name of the student=%s\n",s1.name);

printf("Combination=%s\n",s1.combination);

printf("Percentage=%f\n",s1.percentage);

getch();

}

Output:

Enter the roll number: 1

Enter the name of the student: Hanumanth                                       

Enter the combination: pcmc                                                     

Enter the percentage: 80                                                       

Roll number=1                                                                  

Name of the student=Hanumanth                                                  

Combination=pcmc                                                               

Percentage=80.000000 
Write a program in c to display student data using structure Write a program in c to display student data using structure Reviewed by Vision Academy on December 14, 2021 Rating: 5

No comments:

CheckOut

Powered by Blogger.