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
What does sizeof function do?
What is wrong with this program statement?
What are pointers?
List some of the static data structures in C?
What are the functions to open and close the file in c language?
Take an MxN matrice from user and then sum upper diagonal in a variable and lower diagonal in a separate variables. Print the result
Is fortran still used today?
Write a C/C++ program to add a user to MySQL. The user should be permitted to only "INSERT" into the given database.
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
Why is sizeof () an operator and not a function?
What are loops c?
What is a constant and types of constants in c?
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?
how to print the character with maximum occurence and print that number of occurence too in a string given ?
plz let me know how to become a telecom protocol tester. thank you.