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


Please Help Members By Posting Answers For Below Questions

the 'sizeof' operator reported a larger size than the calculated size for a structure type. What could be the reason?

568


How can I convert a number to a string?

610


Why is structure important for a child?

605


write a program to reverse a every alternetive words in a string in a place. EX: Input is "this is the line of text" Output should be "shit is eht line fo text" Please any one tell me code for that.

1580


what will be maximum number of comparisons when number of elements are given?

1413






Explain how can a program be made to print the line number where an error occurs?

696


we called a function and passed something do it we have always passed the "values" of variables to the called function. such functions calles are called a) calls by reference b) calls by value c) calls by zero d) none of the above

639


Given two strings S1 and S2. Delete from S2 all those characters which occur in S1 also and finally create a clean S2 with the relevant characters deleted.

838


Explain zero based addressing.

612


Why header files are used?

648


What is bubble sort in c?

640


my project name is adulteration of chille powder.how can i explain it to the hr when he asks me about the project?

1123


What is type qualifiers?

666


What is sizeof int in c?

606


i = 25;switch (i) {case 25: printf("The value is 25 ");case 30: printf("The value is 30 "); When the above statements are executed the output will be : a) The value is 25 b) The value is 30 c) The value is 25 The value is 30 d) none

650