write a c program to store and print name,address,roll.no of
a student using structures?
Answer Posted / balaji ganesh
#include<string.h>
#include<conio.h>
#include<stdio.h>
struct student
{
char name[20],adr[5][10];
int no;
}s;
main()
{
int i,j;
clrscr();
scanf("%d",&s.no,printf("enter no of the student:"));
scanf("%s",s.name,printf("enter name of student:"));
printf("enter address(5 lines):\n");
for(i=0;i<=5;i++)
{
j=0;
while((s.adr[i][j++]=getchar())!='\n');
}
printf("\nstudent details are:\n\nRoll.no: %d\n\nName : %s\n\nadress:",s.no,s.name);
for(i=0;i<=5;i++)
printf("\t%s",s.adr[i]);
getch();
}
| Is This Answer Correct ? | 139 Yes | 97 No |
Post New Answer View All Answers
What are the 5 organizational structures?
How are pointers declared in c?
Draw a flowchart to produce a printed list of all the students over the age of 20 in a class .The input records contains the name and age of students. Assume a sentinel value of 99 for the age field of the trailer record
How do we open a binary file in Read/Write mode in C?
I have a varargs function which accepts a float parameter?
How can I read in an object file and jump to locations in it?
What is an operator?
Explain what are preprocessor directives?
What is array within structure?
An application package has been provided to you without any documents for the following application. The application needs to be tested. How will you proceed?
write a program to concatenation the string using switch case?
What is new line escape sequence?
What is the need of structure in c?
What are the types of operators in c?
Can two or more operators such as and be combined in a single line of program code?