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
Explain how can I convert a string to a number?
What is the difference between test design and test case design?
Why is c called c?
What is pass by reference in c?
What is getch?
what is diffrence between linear and binary search in array respect to operators?what kind of operator can be used in both seach methods?
What is the difference between memcpy and memmove?
What are the different types of objects used in c?
What does sizeof function do?
Why is C language being considered a middle level language?
How can I find out the size of a file, prior to reading it in?
Are the outer parentheses in return statements really optional?
If you know then define #pragma?
Can a pointer be static?
What do you understand by friend-functions? How are they used?