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
how many errors in c explain deply
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
What are the types of bitwise operator?
Is this program statement valid? INT = 10.50;
int i=10; printf("%d %d %d", i, i=20, i);
What are compound statements?
Write a program to print ASCII code for a given digit.
How can I get random integers in a certain range?
Why can arithmetic operations not be performed on void pointers?
Are enumerations really portable?
How can I automatically locate a programs configuration files in the same directory as the executable?
Can you define which header file to include at compile time?
What is the difference between int main and void main in c?
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.
What is a lookup table in c?