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


Please Help Members By Posting Answers For Below Questions

Explain how do you print an address?

661


What is static memory allocation? Explain

634


How can I read data from data files with particular formats?

607


What is volatile keyword in c?

587


What is nested structure with example?

629






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...

4907


What is atoi and atof in c?

620


How do you list a file’s date and time?

637


How can you read a directory in a C program?

655


Differentiate between ordinary variable and pointer in c.

622


What does void main () mean?

738


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.

1624


Which is the memory area not included in C program? give the reason

1510


Why is c not oop?

541


Which built-in library function can be used to match a patter from the string?

749