117./*Write a program to print the records in
structure variable by user*/
#include<stdio.h>
#include<conio.h>
struct data
{
int rno;
int marks;
char name[20];
};
void main()
{
struct data
stu1;
clrscr();
printf("\n
Enter Roll No.:");
scanf("%d",&stu1.rno);
printf("\n
Enter Name:");
fflush(stdin);
gets(stu1.name);
printf("\n
Enter Marks:");
scanf("%d",&stu1.marks);
printf("\n\n");
printf("\n\t
Roll No.\tName\t\t Marks");
printf("\n%12d",stu1.rno);
printf("\t%15s",stu1.name);
printf("%12d",stu1.marks);
getch();
}
OUTPUT
Enter
Roll No. 30
Enter
Name:RAMKUMAR
Enter
Marks: 90
Roll
No. Name Marks
30 RAMKUMAR 90
No comments:
Post a Comment