Twitter Feed Facebook Google Plus Youtube

Adsense responsive

Recent Post below header

Friday, 8 March 2013

EXAMPLE OF STRUCTURE IN C PROGRAMMING

CODING:
#include<conio.h>
#include<stdio.h>
struct stud_record
{
 char name[25];
 char cls[5];
 int roll_no;
};
main()
{
 struct stud_record student1,student2;
 clrscr();
 printf("Enter name: ");
 scanf("%s",student1.name);
 printf("Enter class: ");
 scanf("%s",student1.cls);
 printf("Enter roll no.: ");
 scanf("%d",&student1.roll_no);
 printf("\n");
 printf("Enter name: ");
 scanf("%s",student2.name);
 printf("Enter class: ");
 scanf("%s",student2.cls);
 printf("Enter roll no.: ");
 scanf("%d",&student2.roll_no);
 printf("\n\n");
 printf("RECORD 1\nName: %s\nClass: %s\n",student1.name,student1.cls);
 printf("Roll no. %d\n\n",student1.roll_no);
 printf("RECORD 2\nName: %s\nClass: %s\n",student2.name,student2.cls);
 printf("Roll no. %d\n\n",student2.roll_no);
 getch();
}


CODING

OUTPUT


For any query or suggestion please comment below...

No comments:

Post a Comment