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 / abuubkar
#include <stdio.h>
#include <string.h>
struct student
{
int roll;
char name[50];
char dept[50];
int course;
int yoj;
};
main()
{
struct student std[5];
int i;
for (i=0;i<2;i++)
{
printf("enter roll of student %d
",i+1);
scanf("%d",&std[i].roll);
printf("enter name of student %d
",i+1);
scanf("%s",&std[i].name);
printf("enter department of student %d
",i+1);
scanf("%s",&std[i].dept);
printf("enter couse of student %d
",i+1);
scanf("%d",&std[i].course);
printf("enter year of join of the student %d
",i+1);
scanf("%d",&std[i].yoj);
}
for (i=0;i<2;i++)
{
printf("The information of student %d is
",i+1);
printf("%d
%s
%s
%d
%d",std[i].roll,std[i].name,std[i].dept,std[i].course,std[i].yoj);
}
}
| Is This Answer Correct ? | 2 Yes | 6 No |
Post New Answer View All Answers
What is use of bit field?
What are the loops in c?
There seem to be a few missing operators ..
What are the advantages of the functions?
I heard that you have to include stdio.h before calling printf. Why?
Write a program to generate random numbers in c?
What is the use of define in c?
What are the different types of linkage exist in c?
What is pointer to pointer in c with example?
What are local static variables?
What is advantage of pointer in c?
What is the use of a semicolon (;) at the end of every program statement?
Explain union.
diff between exptected result and requirement?
What are data structures in c and how to use them?