SUMMER TRAINING Free Tutorials  Go To Your University  Placement Preparation 
Project Based Best Summer Training Courses in Jaipur
Join our Telegram Channel To take free Online Courses
0 like 0 dislike
83 views
in GTU B.E. (CSE-I-Sem) Programming For Problem Solving Lab by Goeduhub's Expert (7.1k points)

Design a structure student_record to contain name, branch and total marks obtained. Develop a program to read data for 10 students in a class and print them.

1 Answer

0 like 0 dislike
by Goeduhub's Expert (7.1k points)
edited by
 
Best answer

In this program we are going to implement a structure called student_record. It contains member variables as student name, branch name, total marks.

To learn about structure and union from beginning Click Here.

Example :

#include<stdio.h>
#include<conio.h>

//Declaration of structure student_record
struct student_record{

//Member variables of student_record
char student_name[30],branch_name[30];
int total_marks;
}student[10];

void main()
{
int i,n;
clrscr();

//Number of students to include
printf("\nEnter the number of students you want to include:");
scanf("%d",&n);

//Student information
printf("\nEnter the following information related to students");
for(i=0;i<n;i++)
{
printf("\nStudent %d Name:",i+1);
scanf("%s",&student[i].student_name);
printf("\nBranch Name:");
scanf("%s",&student[i].branch_name);
printf("\nTotal Marks:");
scanf("%d",&student[i].total_marks);
}

//Printing student information on output window
printf("\nEntered Information:");
printf("\n|| S.No. ||  Student Name      ||    Branch Name    ||   Total Marks  ||");
for(i=0;i<n;i++)
printf("\n||  %d    ||   %s             ||       %s        ||          %d     ||",i+1,student[i].student_name,student[i].branch_name,student[i].total_marks);
getch();
}

Output :

Output of above program showing structure operation


For More GTU C Programming Lab Experiments Click Here

Our Mentors(For AI-ML)


Sharda Godara Chaudhary

Mrs. Sharda Godara Chaudhary

An alumna of MNIT-Jaipur and ACCENTURE, Pune

NISHA (IIT BHU)

Ms. Nisha

An alumna of IIT-BHU

Related questions

 Goeduhub:

About Us | Contact Us || Terms & Conditions | Privacy Policy || Youtube Channel || Telegram Channel © goeduhub.com Social::   |  | 
...