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
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.
What is the code in while loop that returns the output of given code?
Why is struct padding needed?
Can we replace the struct function in tree syntax with a union?
c program to compute AREA under integral
What are the characteristics of arrays in c?
If fflush wont work, what can I use to flush input?
Can you subtract pointers from each other? Why would you?
Why C language is a procedural language?
Is that possible to add pointers to each other?
Write a c program to build a heap method using Pointer to function and pointer to structure ?
Is sizeof a keyword in c?
Do pointers store the address of value or the actual value of a variable?
Write a program to reverse a linked list in c.
Which control loop is recommended if you have to execute set of statements for fixed number of times?