How to write a C Program To Store Students Record Using Structure in C Programming Language ?
Solution For C Program :
/*C Program To Store Students Record Using Structure.*/
#include<stdio.h>
#include<conio.h>
struct student{
int role_no;
char name[20];
int marks;
char course[20];
};
struct student stud[10];
void main()
{
int i;
clrscr();
printf("enter the students record one by one.\n");
for(i=0;i<3;i++)
{
printf("Enter the role no= ");
scanf("%d",&stud[i].role_no);
printf("Enter the name of student: ");
scanf("%s",&stud[i].name);
printf("Enter the marks obtained= ");
scanf("%d",&stud[i].marks);
printf("Enter the course: ");
scanf("%s",&stud[i].course);
}
clrscr();
printf("---------STUDENTS RECORD FILE-------\n");
for(i=0;i<3;i++)
{
printf("\nROLE NO.: %d",stud[i].role_no);
printf("\nNAME: %s",stud[i].name);
printf("\nCOURSE: %s",stud[i].course);
printf("\nMARKS OBTAINED: %d",stud[i].marks);
printf("\n----------------------------------\n\n");
}
getch();
}
You may also learn these C Program/Code :
C Program To Swap Two Numbers Without Using Third Variable
Learn More :
Record
Store
- C Program To Store Students Record In A Text File
- C program calculates a given function in range given by user, stores the data in arrays and displays the answer in a table.
- C Program to calculate sum of two m*n matrices & store the result in 3 matrix
- C Program to accept n numbers from user store these numbers into an array & calculate average of n numbers
- C Program to accept n numbers & store all prime numbers in an array & display this result
- C program to accept n number from user,store these numbers into an array & count the no of occurrences of each number
- C Program to accept n numbers from user store these numbers into an array & reverse an array elements using function
- C Program to accept 5 names from user & store these names into an array. Sort these array elements in alphabetical order
- C Program to accept n numbers from user,store these numbers into an array & sort the number of an array
- C Program to accept n numbers from user, store these numbers into an array. Find out Maximum & Minimum number from an Array
- C Program to accept data from user store that data into text file
- Find the union and intersection of two sets of integer store it in two array C Program
- Accept n number from user, store these number into an array and calculate the average of n number
- C Program - Hash Table to store information about a student
- C Program to Input Student Details into a File For Two Subjects
Structure
- C Program Structure Example-2
- C Program Structure Example
- C Program To Make Employee Payment Record Using Structure
- Generic stack in C Program
- C Program To Multiply Two Polynomials
- C Program LEXICAL ANALYSER
- C Program Implement Binary Search Tree And Its Traversals
- GJK C Program Example-1
- Adding two polynomial functions C Program Using Structure