Q-1: Create a structure to specify data on students given
below:
Roll number, Name, Department, Course, Year of joining
Assume that there are not more than 450 students in the
college.
Answer Posted / prathmesh dewade
#include<stdio.h>
struct stud{
int roll;
char name[50];
int dep;
char c[50];
int year;
};
main()
{
struct stud st[5];
int i;
for(i=0;i<5;i++)
{
printf("
enter student record %d
",i+1);
printf("enter Roll no
");
scanf("%d",&st[i].roll);
printf("enter Name ");
scanf(" %s",&st[i].name);
printf("
enter department ");
scanf("%d",&st[i].dep);
printf("
enter Course ");
scanf(" %s",&st[i].c);
printf("
enter Year of joining");
scanf(" %d",&st[i].year);
}
for(int i=0;i<5;i++)
{
printf("Roll:%d, Name:%s, DepNo:%d,Course:%s, YearOfJoin:%d
",st[i].roll,st[i].name,st[i].dep,st[i].c,st[i].year);
}
}
Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
What are keywords in c with examples?
What is an endless loop?
What is nested structure with example?
What is the use of #define preprocessor in c?
What is 1d array in c?
What is the difference between functions getch() and getche()?
Write a program to swap two numbers without using a temporary variable?
How do I read the arrow keys? What about function keys?
What is assert and when would I use it?
how to create duplicate link list using C???
What are header files why are they important?
When is the “void” keyword used in a function?
What are the basic data types associated with c?
Explain Function Pointer?
Difference between exit() and _exit() function?