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
Write a factorial program using C.
Explain high-order and low-order bytes.
Is there any demerits of using pointer?
Can you return null in c?
What are static variables in c?
Write a function expand(s1,s2) that expands shorthand notations like a-z in the string s1 into the equivalent complete list abc...xyz in s2 . Allow for letters of either case and digits, and be prepared to handle cases like a-b-c and a-z0-9 and -a-z. z-a:zyx......ba -1-6-:-123456- 1-9-1:123456789987654321 a-R-L:a-R...L a-b-c:abbc
What is indirection?
how many key words availabel in c a) 28 b) 31 c) 32
What is string length in c?
Explain about the functions strcat() and strcmp()?
What is header file definition?
FORMATTED INPUT/OUTPUT functions are a) scanf() and printf() b) gets() and puts() c) getchar() and putchar() d) all the above
What is scope and lifetime of a variable in c?
Explain how are portions of a program disabled in demo versions?
Combinations of fibanocci prime series