write a c program to store and print name,address,roll.no of
a student using structures?

Answer Posted / raj

#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 ?    33 Yes 28 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

WHAT IS THE DEFINATION OF IN TECHNOLOGY AND OFF TECHNOLOGY ?

1853


When is a void pointer used?

672


What is the difference between mpi and openmp?

728


Explain what is wrong with this statement? Myname = ?robin?;

992


What does the characters “r” and “w” mean when writing programs that will make use of files?

849






Can the “if” function be used in comparing strings?

586


write a program to convert a expression in polish notation(postfix) to inline(normal) something like make 723+* (2+3) x 7 (not sure) just check out its mainly printing expression in postfix form to infix.

2264


Write a program to print "hello world" without using a semicolon?

591


Is it fine to write void main () or main () in c?

543


What is the modulus operator?

730


Some coders debug their programs by placing comment symbols on some codes instead of deleting it. How does this aid in debugging?

651


Are pointers integer?

545


Tell me is null always defined as 0(zero)?

666


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

739


Differentiate between functions getch() and getche().

618