write a c program to store and print name,address,roll.no of
a student using structures?
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / 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 |
Answer / fasfasdfdsaf
http://www.cprogrammingexpert.com/C/Tutorial/fundamentals/datatypes/data_types.aspx
Is This Answer Correct ? | 8 Yes | 18 No |
Answer / nidhina
enter the number of students 2
enter the name anu
enter the address ui
fh
fn
hg
hgn
rollno 2
name anu
address
ui fh
fn
hg
hgn
Is This Answer Correct ? | 2 Yes | 15 No |
Answer / laxmi bose
#include<stdio.h>
#include<string.h>
#include<conio.h>
struct laxmi
{
int rollname;
char name;
char address;
}struct laxmi l;
void main()
{
scanf("%d%c%c",&rollname,name,address);
printf("%d%c%c",roolname,name,address);
}
Is This Answer Correct ? | 54 Yes | 88 No |
Answer / carrie
write a program to accept a salesman name and monthly sales
amount and calculate the commision as per the given criteria
SALES COMMISION
<=10000 0
>10000 and <=25000 10% of sales amount
>25000 and <=100000 20% of sales amount
>100000 25% of sales amount
Is This Answer Correct ? | 12 Yes | 59 No |
union { char ch[10]; short s; }test; test.s = 0xabcd; main() { printf("%d",ch[10]); }
What is indirection in c?
Determine if a number is a power of 2 at O(1).
How can I read a binary data file properly?
WHAT IS INT?
What is the deal on sprintf_s return value?
Write a Program to accept different goods with the number, price and date of purchase and display them
in a town the percentage of men is 52 the percentage of total literacy is 48 if total percentage of literate men is 35 of the total population write a program to find the total no of the literate men and women if the population of the town is 80000
What is the use of a ‘