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 / shyam kumar thapa
/*Program to specify data of students*/
#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;
printf("Enter the number of student(s)");
scanf("%d",&n)
printf("Enter the record of student(s)\n");
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("Data of students are");
for(i=0;i<n;i++)
{
printf("Name of student is %s\t",stud[i].name);
printf("Departemt of student is %s\t",stud[i].dept);
printf("Roll no of student is %d\t";stud[i].roll);
printf("Year of joining is %d\t",stud[i].year_join);
printf("Course of student is %s\t",stud[i].course);
}
getch();
}
| Is This Answer Correct ? | 123 Yes | 57 No |
Post New Answer View All Answers
Why pointers are used in c?
What is the use of extern in c?
Do you know the use of 'auto' keyword?
Add Two Numbers Without Using the Addition Operator
What are data types in c language?
What are the basic data types associated with c?
What is a structure member in c?
Describe the difference between = and == symbols in c programming?
What are the uses of null pointers?
What are categories used for in c?
how to make a scientific calculater ?
How can I list all of the predefined identifiers?
Is it valid to address one element beyond the end of an array?
Write a program on swapping (100, 50)
How do I round numbers?