Q:

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

belongs to collection: Structure Programs in C Programming

0

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;
};

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()
{
    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;
}#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:

Enter The Information of Students :

Enter Name : Mohamad

Enter Roll No. : 147917

Enter marks : 78.80

Displaying Information

Name: Mohamad

Roll: 147917

Marks: 78.80

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

total answers (1)

C Program To Store Information of Students Using S... >>