Q:

C Program To Store Information of Students Using Structure

belongs to collection: Structure Programs in C Programming

0

 C Program To Store Information of Students Using Structure or Write A C Program To Store Multiple Students Information of Using Structure Like (Roll No., Name, Marks) or c program to store information of 10 students using structure or c program for student mark sheet using structure or c program using structures employee details or student mark list program in c using an array or c program using structure to find students grades in a class or c program for student details using files or simple c program for student mark list or c program using structure array.

What Is Structure?

The structure is a user-defined data type in C which allows you to combine different data types to store a particular type of record. Structure helps to construct a complex data type in a more meaningful way. It is somewhat similar to an Array. The only difference is that array is used to store a collection of similar datatypes while structure can store a collection of any type of data.

The structure is used to represent a record. Suppose you want to store a record of Student which consists of student name, address, roll number and age. You can define a structure to hold this information.

Defining a structure

struct keyword is used to define a structure. struct define a new data type which is a collection of different type of data.

Syntax :

struct structure_name
{
//Statements
};


Logic:- 

Here we are storing a student information using structure we are taking input from Roll Number, Name & Marks. But you can Store multiple Student information as you want 

 
Structure Declare:-
 
struct student
{

    char name[50];

    int roll;

    float marks;

};

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

#include <stdio.h>
struct student
{
char name[50];
int roll;
float marks;
}; 

int main()
{
int i, n; 

printf("Enter The Total Number Of Student : ");
scanf("%d",&n);

struct student s[n];

printf("\nEnter Information of students (Marks Sholud be Float Like 78.00):\n");

for(i=0;i<n;i++)
{
printf("\nRoll No. : ");
scanf("%d",&(s[i].roll));

printf("Name : ");
scanf("%s",s[i].name);

printf("Marks : ");
scanf("%f",&(s[i].marks));
}

printf("\nDisplaying All Information of Students :\n");

for(i=0;i<n;i++)
{
printf("\nRoll No. : %d",s[i].roll);
printf("\nName : %s",s[i].name);
printf("\nMarks : %f",s[i].marks);
printf("\n\n");
}
return 0;

}

 

Output:

Enter The Total Number Of Student : 3

Enter Information of students (Marks Sholud be Float Like 78.00):

Roll No. : 147917

Name : mohamad

Marks : 78.00

Roll No. : 147939

Name : nour

Marks : 96.3

Roll No. : 147910

Name : laila

Marks : 88.5

Displaying All Information of Students :

Roll No. : 147917

Name : mohamad

Marks : 78.000000

Roll No. : 147939

Name : nour

Marks : 96.300003

Roll No. : 147910

Name : laila

Marks : 88.500000

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

C Program To Add Two Complex Numbers Using Structu... >>
<< C Program To Store Student Information Like (Name,...