Friday, 15 April 2016

C Program To Store Student Information Like (Name, Roll & Marks) Using Structure

Problem:- Write A C Program To Store Student Information Like (Name, Roll & Marks) Of Single Student Using Structure or C Program to Store Information of Students Using Structure or C Program to Store Information(name, roll, and marks) of a Student or Program to maintain student details using structures or C Program to read name and marks of students and store it in file or C Program to display student details using structure members or C Program to Read and Print details of 50 Students using Structure or C Program Using Structure to Calculate Marks of 10 Students or C Program to Store Records of Students in an Array or C Program to Sort Array of Structure using Bubble Sort or Program to Store Information of Students Using Structure in C or Structure Student (Name, Marks, Roll Number) Program in C or A program using structures in C to store student information.

What Is Structure

The structure is a user-defined data type in C. 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 single student information like roll number, name and marks Not using for loop

So just define a structure like Below.


struct student
{
    char name[50];
    int roll;
    float marks;
};

Then Store the information in structure See the Example how Store the info in structure 

printf("Enter The Information of Students :\n\n");
    
printf("Enter Name : ");
scanf("%s",s.name);
    
printf("Enter Roll No. : ");
scanf("%d",&s.roll);
    
printf("Enter marks : ");
scanf("%f",&s.marks); 

And Then Displaying the Stored Information.

printf("Name: %s\n",s.name);
printf("Roll: %d\n",s.roll);
printf("Marks: %.2f\n",s.marks);

See The Below Problem For Handling a multiple Student Data Using Array, Like Name, Roll Number and Marks.

Try This C Program To Store Multiple Students Information of Using Structure

Solution:-

#include <stdio.h>
struct student
{
    char name[50];
    int roll;
    float marks;
};
int main()
{
  //Ghanendra Yadav
    struct student s;
    
printf("Enter The Information of Students :\n\n");
    
printf("Enter Name : ");
    scanf("%s",s.name);
    
printf("Enter Roll No. : ");
    scanf("%d",&s.roll);
    
    printf("Enter marks : ");
    scanf("%f",&s.marks);
    
    printf("\nDisplaying Information\n");
    
printf("Name: %s\n",s.name);
    printf("Roll: %d\n",s.roll);
    printf("Marks: %.2f\n",s.marks);
    return 0;
}

Output:-

C Program To Store Student Information Like (Name, Roll & Marks) Using Structure


You May Also See


1. C Program To Find Area And Circumference Of Circle

2. C Program To Print ASCII Value Of Character

3. C Program To Find Area Of Triangle

4. C Program to Convert a person's name in Abbreviated

5. C Program For Calculate A Simple Interest

6. C Program To Find Greater No. Among given Three Number

7. C Program For Find The Gross Salary Of An Employee

8. C Program For Calculate Percentage Of 5 Subjects

9. C Program For Converting Temperature Celsius Into Fahrenheit

10. C Program To Display Size Of Different Datatype


Extreme Recommended:- Like our Facebook Page or Join our Facebook Group and Google plus Community for up-to-date. If you have any Query or Question you can ask in the group, I will Try To Solve your Query and try to answers of your Questions withing 24 Hours, You can also Email me or comment below Please suggest to your Friends to join and like our page and don't forget to Subscribe. Enter your Email and click to subscribe.

Ghanendra Yadav

Ghanendra Yadav

Hello, I Am Ghanendra Yadav Owner of This Blog, I am professional Blogger and Programmer. I Love Programming, Logo Making, And Banner Designing. My Highest Qualification is MCA From NIT Warangal. You Can Find Me On Social Media Through Below Link And If You Have Any Query Related To Programming And Other Subject Comment Below or You Can Mail Me I Will Try To Answer Within 24 Hours Email:- yghanendra@student.nitw.ac.in

Find me on Social Media

Facebook | Twitter | Google+ | RSS Feed

No comments:

Post a Comment