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 / gaurav

#include <stdio.h>
#include <conio.h>
struct student
{
char name[20],dept[20],course[20];
int roll, year_join;
}stud[450];
void main ()
{
int i,n;
printf("Enter the number of student(s)");
scanf("%d",&n);
printf("Enter the record of student(s)
");
for(i=0;i<n;i++)
{
printf("Enter name");
scanf("%s",&stud[i].name);
printf("Enter Department");
scanf("%s",&stud[i].dept);
printf("Enter Roll no");
scanf("%d",&stud[i].roll);
printf("Enter year of joining");
scanf("%d", &stud[i].year_join);
printf("Enter course");
scanf("%s",&stud[i].course);
}
printf("Data of students are");
for(i=0;i<n;i++)
{
printf("Name of student is %s ",stud[i].name);
printf("Departemt of student is %s ",stud[i].dept);
printf("Roll no of student is %d ",stud[i].roll);
printf("Year of joining is %d ",stud[i].year_join);
printf("Course of student is %s ",stud[i].course);
}
getch();
}

Is This Answer Correct ?    7 Yes 8 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is it better to use a macro or a function?

668


All technical questions

1526


a=10;b= 5;c=3;d=3; if(a printf(%d %d %d %d a,b,c,d) else printf("%d %d %d %d a,b,c,d);

656


What is wrong with this statement? Myname = 'robin';

836


How do you determine whether to use a stream function or a low-level function?

668






What is the difference between malloc() and calloc()?

628


In c programming, explain how do you insert quote characters (? And ?) Into the output screen?

778


Explain how do you list a file’s date and time?

633


What is a example of a variable?

565


Is this program statement valid? INT = 10.50;

703


What is 1d array in c?

616


Explain what is the concatenation operator?

638


Linked lists -- can you tell me how to check whether a linked list is circular?

656


Can we add pointers together?

628


What are the 5 types of inheritance in c ++?

596