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 does sizeof function do?

614


What is wrong with this program statement?

610


What are pointers?

634


List some of the static data structures in C?

762


What are the functions to open and close the file in c language?

595






Take an MxN matrice from user and then sum upper diagonal in a variable and lower diagonal in a separate variables. Print the result

1469


Is fortran still used today?

604


Write a C/C++ program to add a user to MySQL. The user should be permitted to only "INSERT" into the given database.

1497


write a programe to accept any two number and check the following condition using goto state ment.if a>b,print a & find whether it is even or odd and then print.and a

1452


Why is sizeof () an operator and not a function?

589


What are loops c?

616


What is a constant and types of constants in c?

604


1) There is a singing competition for children going to be conducted at a local club. Parents have been asked to arrive at least an hour before and register their children’s names with the Program Manager. Whenever a participant registers, the Program Manager has to position the name of the person in a list in alphabet order. Write a program to help the Program Manager do this by placing the name in the right place each time the Program Manger enters a name. The Logic should be written in Data Structures?

1918


how to print the character with maximum occurence and print that number of occurence too in a string given ?

2036


plz let me know how to become a telecom protocol tester. thank you.

1742