C Program To Print The ID And Name Of Each Student Using Struct #3


♣ Try it Out ::
#include<stdio.h>
#include<conio.h>

struct student
{
    int id;
    char name[25];
};

main()
{
    int TS, i;
    printf("Enter total number of students: ");
    scanf("%d", &TS);

    struct student s[TS];

    printf("Enter id & name of %d students: \n", TS);

    for(i=0; i<TS; i++)
    {
        scanf("%d", &s[i].id);
        gets(s[i].name);
    }

    for(i=0; i<TS; i++)
    {
        printf("\nStudent id\t: %d\n", s[i].id);
        printf("Student name\t:%s\n\n", s[i].name);
    }

    getch();
    return(0);
}

♣ Output ::
Enter total number of students: 3
Enter id & name of 3 students:
1002020001 Nurul Amin Muhit
1002020002 Raju Ahmed Bappa
1002020008 Foyjul Karim Moslu

Student id      : 1002020001
Student name    : Nurul Amin Muhit


Student id      : 1002020002
Student name    : Raju Ahmed Bappa


Student id      : 1002020008
Student name    : Foyjul Karim Moslu

♣ Downloads ::

Comments

Popular posts from this blog

C++ :: Topological Sort Algorithm (using DFS)

How to Hack Facebook Account

C++ :: Strongly Connected Components Algorithm (SCC)