Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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

Explain the difference between the local variable and global variable in c?

1073


What is the difference between array and pointer in c?

1162


Give a one-line C expression to test whether a number is a power of 2. [No loops allowed - it's a simple test.]

1087


int main() { Int n=20,i; For(i=0;i<=n;i--) { Printf(“-“); Return 0;

1827


What is meant by preprocessor in c?

1014


What is string function in c?

983


Is javascript based on c?

1063


Explain what could possibly be the problem if a valid function name such as tolower() is being reported by the c compiler as undefined?

1013


What is enumerated data type in c?

1081


How can I avoid the abort, retry, fail messages?

1137


What do you mean by dynamic memory allocation in c?

1105


in linking some of os executables are linking name some of them

2132


Where are some collections of useful code fragments and examples?

1162


Is c a great language, or what?

1114


Why #include is used in c language?

1052