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


Please Help Members By Posting Answers For Below Questions

When I tried to go into a security sites I am denied access and a message appeared saying 'applet not initialize'. How can I rectify this problem.

1745


What is the code in while loop that returns the output of given code?

1634


Why is struct padding needed?

811


Can we replace the struct function in tree syntax with a union?

1001


c program to compute AREA under integral

2072


What are the characteristics of arrays in c?

805


If fflush wont work, what can I use to flush input?

836


Can you subtract pointers from each other? Why would you?

742


Why C language is a procedural language?

795


Is that possible to add pointers to each other?

1110


Write a c program to build a heap method using Pointer to function and pointer to structure ?

4390


Is sizeof a keyword in c?

753


Do pointers store the address of value or the actual value of a variable?

814


Write a program to reverse a linked list in c.

845


Which control loop is recommended if you have to execute set of statements for fixed number of times?

1080