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
the 'sizeof' operator reported a larger size than the calculated size for a structure type. What could be the reason?
How can I convert a number to a string?
Why is structure important for a child?
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.
what will be maximum number of comparisons when number of elements are given?
Explain how can a program be made to print the line number where an error occurs?
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
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.
Explain zero based addressing.
Why header files are used?
What is bubble sort in c?
my project name is adulteration of chille powder.how can i explain it to the hr when he asks me about the project?
What is type qualifiers?
What is sizeof int in c?
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