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 ? | 122 Yes | 56 No |
Post New Answer View All Answers
Explain how do you print an address?
What is static memory allocation? Explain
How can I read data from data files with particular formats?
What is volatile keyword in c?
What is nested structure with example?
How to write a code for implementing my own printf() and
scanf().... Please hep me in this... I need a guidance...
Can you give an coding for c... Please also explain about
the header files used other than #include
What is atoi and atof in c?
How do you list a file’s date and time?
How can you read a directory in a C program?
Differentiate between ordinary variable and pointer in c.
What does void main () mean?
Write a programme using structure that create a record of students. The user allow to add a record and delete a record and also show the records in ascending order.
Which is the memory area not included in C program? give the reason
Why is c not oop?
Which built-in library function can be used to match a patter from the string?