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 / mrityunjay yadav

#include<stdio.h>
struct students
{
int Roll_no;
char name[50];
char deptt[20];
char course[30];
int year_of_passing;
};
void main()
{
struct students s[500];
int n,i,year,rollno,ccy,found=0;

clrscr();

printf("\nEnter number of students : ");
scanf("%d",&n);
printf("\nEnter the course completion period(in years) : ");
scanf("%d",&ccy);

printf("\nEnter student details : \n");
for(i=0;i<n;i++)
{
printf("\n\nEnter details for student : %d",i+1);
printf("\nRoll No : ");
scanf("%d",&s[i].Roll_no);
printf("\nName : ");
scanf("%s",s[i].name);
printf("\nDepat. : ");
scanf("%s",s[i].deptt);
printf("\nCourse : ");
scanf("%s",s[i].course);
printf("\nYear of Passing : ");
scanf("%d",&s[i].year_of_passing);
}
printf("\nQuestion 1 -> Enter the year of joining : ");
scanf("%d",&year);
printf("\nName of the Students\n------------------------------…
for(i=0;i<n;i++)
{
if(s[i].year_of_passing==(ccy+year))
{
printf("\n%s",s[i].name);
found=1;
}
}
if(found==1);
else printf("\nNo record Found\n");
found=0;
printf("\nQuestion 2 -> Enter the roll no : ");
scanf("%d",&rollno);

if(s[i].Roll_no==rollno)
{
found=1;
printf("\nName : %s\nDept. : %s\nCourse :
%s\n",s[i].name,s[i].deptt,s[i].course);
}
if(found==1);
else printf("\nNo record Found\n");

getchar();
}

Is This Answer Correct ?    29 Yes 25 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

how many errors in c explain deply

1625


what are the program that using a two dimensional array that list the odd numbers and even numbers separately in a given 10 inputs values

1253


What are the types of bitwise operator?

657


Is this program statement valid? INT = 10.50;

685


int i=10; printf("%d %d %d", i, i=20, i);

1006






What are compound statements?

622


Write a program to print ASCII code for a given digit.

679


How can I get random integers in a certain range?

609


Why can arithmetic operations not be performed on void pointers?

583


Are enumerations really portable?

590


How can I automatically locate a programs configuration files in the same directory as the executable?

624


Can you define which header file to include at compile time?

582


What is the difference between int main and void main in c?

589


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.

1617


What is a lookup table in c?

622