FIFA-2022 Career Guide Free Tutorials Go to Your University Placement Preparation 
0 like 0 dislike
2.1k 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

Learn & Improve In-Demand Data Skills Online in this Summer With  These High Quality Courses[Recommended by GOEDUHUB]:-

Best Data Science Online Courses[Lists] on:-

Claim your 10 Days FREE Trial for Pluralsight.

Best Data Science Courses on Datacamp
Best Data Science Courses on Coursera
Best Data Science Courses on Udemy
Best Data Science Courses on Pluralsight
Best Data Science Courses & Microdegrees on Udacity
Best Artificial Intelligence[AI] Courses on Coursera
Best Machine Learning[ML] Courses on Coursera
Best Python Programming Courses on Coursera
Best Artificial Intelligence[AI] Courses on Udemy
Best Python Programming Courses on Udemy

Related questions

 Important Lists:

Important Lists, Exams & Cutoffs Exams after Graduation PSUs

 Goeduhub:

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

 

Free Online Directory

...