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
How is a null pointer different from a dangling pointer?
can any one provide me the notes of data structure for ignou cs-62 paper
I have a varargs function which accepts a float parameter?
What is #line in c?
Do you know pointer in c?
Is there a way to switch on strings?
what is the height of tree if leaf node is at level 3. please explain
What are preprocessor directives in c?
Is null equal to 0 in sql?
"%u" unsigned integer print the a) address of variable b) value of variable c) name of a variable d) none of the above
application attempts to perform an operation?
Why can’t constant values be used to define an array’s initial size?
difference between Low, Middle, High Level languages in c ?
What is context in c?
Is javascript based on c?