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


Please Help Members By Posting Answers For Below Questions

What are keywords in c with examples?

600


What is an endless loop?

796


What is nested structure with example?

616


What is the use of #define preprocessor in c?

611


What is 1d array in c?

596






What is the difference between functions getch() and getche()?

613


Write a program to swap two numbers without using a temporary variable?

601


How do I read the arrow keys? What about function keys?

607


What is assert and when would I use it?

573


how to create duplicate link list using C???

2067


What are header files why are they important?

572


When is the “void” keyword used in a function?

826


What are the basic data types associated with c?

808


Explain Function Pointer?

681


Difference between exit() and _exit() function?

651