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
What do you mean by recursion in c?
Write a program to print fibonacci series without using recursion?
How can you find out how much memory is available?
Explain what is the difference between a free-standing and a hosted environment?
Why do we use int main instead of void main in c?
How can I invoke another program (a standalone executable, or an operating system command) from within a c program?
A program is required to print your biographic information including: Names, gender, student Number, Cell Number, line of study and your residential address.
What is modeling?
When we use void main and int main?
What is c programing language?
How can I implement a delay, or time a users response, with sub-second resolution?
code for find determinent of amatrix
Why is c so important?
What is the acronym for ansi?
What is difference between static and global variable in c?