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


Please Help Members By Posting Answers For Below Questions

What is main function in c?

545


Why is c called a structured programming language?

672


What is an lvalue in c?

690


What is null in c?

596


What is structure data type in c?

564






How can I read/write structures from/to data files?

544


What is context in c?

536


What is the difference between malloc() and calloc()?

613


How do I determine whether a character is numeric, alphabetic, and so on?

619


What is a nested loop?

643


Explain about the functions strcat() and strcmp()?

596


A text file that contains declarations used by a group of functions,programs,or users a) executable file b) header file c) obj file d) .cfile

638


#include main() { char s[] = "Bouquets and Brickbats"; printf(" %c, ",*(&s[2])); printf("%s, ",s+5); printf(" %s",s); printf(" %c",*(s+2)); }

664


What is the difference between exit() and _exit() function?

598


What is volatile c?

519