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 / dolly kushwah

#include <stdio.h>
struct student
{
int rn;
char name[20];
char course[20];
char dept[20];
int yoj;

} s[450];

displaydata (int rn, int n)
{
for (int i = 0; i < n; i++)
{
(rn == s[i].rn) ? printf ("%s %d %s %s %d
", s[i].name, s[i].rn,
s[i].course, s[i].dept,
s[i].yoj) : printf ("roll no not found..
");
}

}

displayname (int yoj, int n)
{
for (int i = 0; i < n; i++)
{
(yoj ==
s[i].yoj) ? (printf ("%s
",
s[i].
name))
: (printf ("no students who are joinig in year %d
", yoj));
}

}

int
main ()
{
int rn, yoj, n, i = 0;

printf ("Enter the no of students...
");

scanf ("%d", &n);
printf ("Enter the name , roll no.,couse, dept , year of joining....
");
for (int i = 0; i < n; i++)
{
scanf ("%s%d%s%s%d", &s[i].name, &s[i].rn, &s[i].course, &s[i].dept,
&s[i].yoj);
}

printf ("Enter the year of joining of students...
");
scanf ("%d", &yoj);
displayname (yoj, n);

printf ("Enter the roll no of students...
");
scanf ("%d", &rn);
displaydata (rn, n);


return 0;
}

Is This Answer Correct ?    4 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the types of data files?

1154


Why c is faster than c++?

981


what do you mean by inline function in C?

1009


Explain the ternary tree?

969


How can I call fortran?

998


What are structure types in C?

1050


Explain how to reverse singly link list.

1074


Simplify the program segment if X = B then C ← true else C ← false

2964


An instruction which is analysed and acted upon by the processor prior to the compiler going its work a) directive b) constructive c) constant d) absolute mode

1037


What will the code below print when it is executed?   int x = 3, y = 4;         if (x = 4)                 y = 5;         else                 y = 2;         printf ("x=%d, y=%d ",x,y);

1817


What is the purpose of & in scanf?

1012


What is the package for freshers(Non IIT) in amazon(hyderabad). And what is the same for those who are a contract employee.

4242


Differentiate between #include<...> and #include '...'

1007


Write a program to generate a pulse width frequency of your choise,which can be variable by using the digital port of your processor

3479


what will be maximum number of comparisons when number of elements are given?

1853