Structure Input and Output

#include<stdio.h>
struct anik
{
    char name[100];
    int age;
    char phnnum[15];

};

int main()
{
    struct anik std1,std2;

    printf("Enter Information For First Student : \n");
    printf("Name : ");
    scanf("%s", std1.name);
    printf("Age : ");
    scanf("%d",  &std1.age);
    printf("Phone Number : ");
    scanf("%s", std1.phnnum);

    printf("\nEnter Information For Second Student : \n");
    printf("Name : ");
    scanf("%s", std2.name);
    printf("Age : ");
    scanf("%d",  &std2.age);
    printf("Phone Number : ");
    scanf("%s", std2.phnnum);

    printf("\nFirst Student : \n");
    printf("Name : %s\n", std1.name);
    printf("Age : %d\n", std1.age);
    printf("Phone Number : %s\n", std1.phnnum);

    printf("\nSecond Student : \n");
    printf("Name : %s\n", std2.name);
    printf("Age : %d\n", std2.age);
    printf("Phone Number : %s\n", std2.phnnum);

    return 0;
}

Comments