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 / taqi haider
#include <stdio.h>
#include <conio.h>
struct student{
char name[20],dept[20],course[20];
int roll, year_join;
}stud[450];
void main (){
int i,n,year;
printf("Enter the number of student(s):");
scanf("%d",&n);
printf("Enter the record of student(s)
");
for(i=0;i<n;i++){
printf("Enter name:");
scanf("%s",&stud[i].name);
printf("Enter Department:");
scanf("%s",&stud[i].dept);
printf("Enter Roll no:");
scanf("%d",&stud[i].roll);
printf("Enter year of joining:");
scanf("%d", &stud[i].year_join);
printf("Enter course:");
scanf("%s",&stud[i].course);
}
printf("
Enter the year of joining:");
scanf("%d",&year);
printf("The Name of the students
------------------
");
for(i=0;i<n;i++){
if(stud[i].year_join==year){
printf("%s
",stud[i].name);
}
}
printf("
-------------------
");
printf("
Data of all students
");
for(i=0;i<n;i++){
printf("
Name of student is %s
",stud[i].name);
printf("Departemt of student is %s
",stud[i].dept);
printf("Roll no of student is %d
",stud[i].roll);
printf("Year of joining is %d
",stud[i].year_join);
printf("Course of student is %s
",stud[i].course);
}
getch();
}
Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What type of function is main ()?
How does selection sort work in c?
Distinguish between actual and formal arguments.
How many levels deep can include files be nested?
What does s c mean on snapchat?
the process of defining something in terms of itself is called (or) in C it is possible for the functions to call themselves. A function called a) nested function b) void function c) recursive function d) indifinite function
What 'lex' does?
What would be an example of a structure analogous to structure c?
Why isn't any of this standardized in c? Any real program has to do some of these things.
What is c language used for?
What is the advantage of c?
What happens if a header file is included twice?
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
I have seen function declarations that look like this
which is an algorithm for sorting in a growing Lexicographic order