About Me

My photo
gandhinagar, gujarat, India
hi.. friends i'am student of kv crpf gandhinagar..and i would like to spread my view and thinking on computer..this blog is for not only those who wants to get knowledge.

Saturday, 7 May 2011

how to create the information of three sudents


#include<conio.h>
#include<stdio.h>
struct student_info
{
char name[10];
char surname[10];
int rollno;
char city[10];
};
void main()
{
clrscr();
       struct student_info student1,student2,student3;
       printf("enter the information about the student 1 :-\n");
       scanf("%s%s%d%s",student1.name,student1.surname,&student1.rollno,student1.city);
       printf("enter the information about the student 2 :-\n");
       scanf("%s%s%d%s",student2.name,student2.surname,&student2.rollno,student2.city);
       printf("enter the information about the student 3 :-\n");
      scanf("%s%s%d%s",student3.name,student3.surname,&student3.rollno,student3.city);


      printf("following are the information of student 1:-\n");
                        printf("name:%s\nsurname:%s\nrollno:%d\ncity:%s",student1.name,student1.surname,student1.rollno,student1.city);
      printf("following are the information of student 2:-\n");
       printf("name:%s\nsurname:%s\nrollno:%d\ncity:%s",student2.name,student2.surname,student2.rollno,student2.city);
     printf("following are the information of student 3:-\n");
      printf("name:%s\nsurname:%s\nrollno:%d\ncity:%s",student3.name,student3.surname,student3.rollno,student3.city);


getch();
}

0 comments:

Post a Comment