0% found this document useful (0 votes)
24 views3 pages

Assignment - 03: // Program For Enters Students Detail

This C program allows a user to enter student data including roll number, name, and average marks for multiple students. It uses a union to store the student data and prompts the user to select entering either the roll number, name, or marks. The data for the specified number of students is input and stored in an array. The program then displays the list of roll numbers, names, or marks depending on the user's initial selection.

Uploaded by

George Brennan
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views3 pages

Assignment - 03: // Program For Enters Students Detail

This C program allows a user to enter student data including roll number, name, and average marks for multiple students. It uses a union to store the student data and prompts the user to select entering either the roll number, name, or marks. The data for the specified number of students is input and stored in an array. The program then displays the list of roll numbers, names, or marks depending on the user's initial selection.

Uploaded by

George Brennan
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

ASSIGNMENT -03

\\ PROGRAM FOR ENTERS STUDENTS DETAIL


#include<stdio.h>
#include<conio.h>
void main()
{
union student
{
int rno;
char sname[20];
int marks;
}
std[25];
int i,n,ch;
clrscr();
printf("\n\t\t------------------------------------");
printf("\n\t\t\t
Student Data " );
printf("\n\t\t------------------------------------");
printf("\n\t\tPress 1. Enter the student Roll no:");
printf("\n\t\t\t2. Enter the Names:");
printf("\n\t\t\t3. Enter the Average marks:");
printf("\n\t\t\t4. To Stop:");
printf("\n\n\t\t\t Enter the choice :\t");
scanf("%d",&ch);
if (ch==4)
goto stop;
printf("\n\t\t\t How many students? :\t");
scanf("%d",&n);
for(i=0;i<n;i++)
{
switch(ch)
{
case 1:
{
printf("\n\t\t\t Rollno.:");
scanf("%d",&std[i].rno);
break;
}
case 2:
{
printf("\n\t\t\t Name:");
scanf("%s",std[i].sname);
break;

}
case 3:
{
printf("\n\t\t\tAverage Marks:");
scanf("%d",&std[i].marks);
break;
}
stop :
case 4:
{
}
}/*------End switch------*/
}/*------End for---------*/
switch(ch)
{
case 1:
{
clrscr();
printf("\n\t\t\t---------------------------------------");
printf("\n\t\t\t Students Rollno.list is:");
printf("\n\t\t\t----------------------------------------");
for(i=0;i<n;i++)
printf("\n\t\t\t %d",std[i].rno);
printf("\n\t\t\t----------------------------------------");
getch();
break;
}
case 2:
{
clrscr();
printf("\n\t\t\t----------------------------------------------");
printf("\n\t\t\t Students Names.list is:");
printf("\n\t\t\t--------------------------------------");
for(i=0;i<n;i++)
printf("\n\t\t\t %s",std[i].sname);
printf("\n\t\t\t---------------------------------------");
getch();
break;
}
case 3:
{
clrscr();
printf("\n\t\t\t----------------------------------------");
printf("\n\t\t\t Students Average Marks list is:");
printf("\n\t\t\t----------------------------------------");
for(i=0;i<n;i++)
printf("\n\t\t\t %d",std[i].marks);
printf("\n\t\t\t----------------------------------------");
getch();

break;
}
}
}

Output:

You might also like