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
Explain union.
How many identifiers are there in c?
Write a program to compute the similarity between two strings - The program should get the two strings as input - Then it will output one single number which is the percentage of similarity between the two strings
Write a C program to accept a matrix of any size. Find the frequency count of each element in the matrix and positions in which they appear in the matrix
how do you execute a c program in unix.
Explain modulus operator. What are the restrictions of a modulus operator?
This is a variation of the call_me function in the previous question:call_me (myvar)int *myvar;{ *myvar += 5; }The correct way to call this function from main() will be a) call_me(myvar) b) call_me(*myvar) c) call_me(&myvar) d) expanded memory
What is typedef struct in c?
What is difference between && and & in c?
What are the different categories of functions in c?
What language is windows 1.0 written?
What is logical error?
What the advantages of using Unions?
How does selection sort work in c?
What is typedf?