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 / prathmesh dewade
#include<stdio.h>
struct stud{
int roll;
char name[50];
int dep;
char c[50];
int year;
};
main()
{
struct stud st[5];
int i;
for(i=0;i<5;i++)
{
printf("
enter student record %d
",i+1);
printf("enter Roll no
");
scanf("%d",&st[i].roll);
printf("enter Name ");
scanf(" %s",&st[i].name);
printf("
enter department ");
scanf("%d",&st[i].dep);
printf("
enter Course ");
scanf(" %s",&st[i].c);
printf("
enter Year of joining");
scanf(" %d",&st[i].year);
}
for(int i=0;i<5;i++)
{
printf("Roll:%d, Name:%s, DepNo:%d,Course:%s, YearOfJoin:%d
",st[i].roll,st[i].name,st[i].dep,st[i].c,st[i].year);
}
}
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
What is scope rule of function in c?
what is a NULL Pointer? Whether it is same as an uninitialized pointer?
How many loops are there in c?
WRITE A CODE IN C TO SEARCH A FILE FROM NOTEPAD FILE.
Is fortran still used today?
How can I pad a string to a known length?
What should malloc(0) do? Return a null pointer or a pointer to 0 bytes?
Is multithreading possible in c?
Explain what is the benefit of using an enum rather than a #define constant?
What are the types of data files?
Why double pointer is used in c?
write a program that types this pattern: 12345678987654321 12345678 87654321 1234567 7654321 123456 654321 12345 54321 1234 4321 123 321 12 21 1 1
What is && in c programming?
Describe the modifier in c?
Is c# a good language?