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 / taqi haider

#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,year;
printf("Enter the number of student(s):");
scanf("%d",&n);
printf("Enter the record of student(s)
");
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("
Enter the year of joining:");
scanf("%d",&year);
printf("The Name of the students
------------------
");
for(i=0;i<n;i++){
if(stud[i].year_join==year){
printf("%s
",stud[i].name);
}
}
printf("
-------------------
");
printf("
Data of all students
");
for(i=0;i<n;i++){
printf("
Name of student is %s
",stud[i].name);
printf("Departemt of student is %s
",stud[i].dept);
printf("Roll no of student is %d
",stud[i].roll);
printf("Year of joining is %d
",stud[i].year_join);
printf("Course of student is %s
",stud[i].course);
}
getch();
}

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

how to introdu5ce my self in serco

1525


Why isnt there a numbered, multi-level break statement to break out

591


Can we increase size of array in c?

544


What are the different categories of functions in c?

649


What is scope of variable in c?

573






Explain what is the difference between the expression '++a' and 'a++'?

629


what is the function of pragma directive in c?

630


what is the difference between class and unio?

1865


What is structure of c program?

609


What is c value paradox explain?

578


Why is sizeof () an operator and not a function?

593


write a program to input 10 strings and compare without using strcmp() function. If the character of one string matches with the characters of another string , sort them and make it a single string ??? example:- str1="Aakash" st2="Himanshu" str="Uday" output:- Aakashimanshuday (please post the answer as quickly as possible)

1629


What is the use of printf() and scanf() functions?

638


Write a program to print "hello world" without using a semicolon?

600


Is null equal to 0 in sql?

657