0% found this document useful (0 votes)
1 views2 pages

Tutorial 10

This document provides a tutorial on creating a structure named STUDENT to store information such as ID, name, age, and marks for two students. It includes a C program that prompts the user to enter details for each student and then displays the entered information. The tutorial is authored by Paras Jogale, a student in the ME program.

Uploaded by

dnyanratna1856
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views2 pages

Tutorial 10

This document provides a tutorial on creating a structure named STUDENT to store information such as ID, name, age, and marks for two students. It includes a C program that prompts the user to enter details for each student and then displays the entered information. The tutorial is authored by Paras Jogale, a student in the ME program.

Uploaded by

dnyanratna1856
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Tutorial No: 10

Tutorial Title: Create a structure STUDENT for storing information (ID, NAME, AGE,
MARKS) and update the structure for 2 students.
Name of Student: Paras Jogale
Class: ME Div: 1 PRN No: B25ME1024 Batch: B

Program:
#include <stdio.h>
struct STUDENT {
int id;
char name[50];
int age;
float marks;
};
int main() {
struct STUDENT s[2];
int i;
printf("Paras Jogale\n");
printf("PRN: B25ME1024\n");

for(i = 0; i < 2; i++) {


printf("Enter details of Student %d:\n", i + 1);
printf("ID: ");
scanf("%d", &s[i].id);
printf("Name: ");
scanf("%s", s[i].name);
printf("Age: ");
scanf("%d", &s[i].age);
printf("Marks: ");
scanf("%f", &s[i].marks);
}

printf("\nStudent Details:\n");

for(i = 0; i < 2; i++) {


printf("\nStudent %d\n", i + 1);
printf("ID: %d\n", s[i].id);
printf("Name: %s\n", s[i].name);
printf("Age: %d\n", s[i].age);
printf("Marks: %.2f\n", s[i].marks);
}

return 0;
}
Output:

You might also like