#include < stdio.h>
#include < string.h>


struct student {
    int id;
    float cgpa;
    char first[100];
    char last[100];
}s[20];
void first_numbers(int x) {
    int i;
    printf("\n\nHere is the details of all student\n\n");
    for (i = 0; i<x; i++) {
        printf("%d %s %s %f \n", s[i].id, s[i].first, s[i].last, s[i].cgpa);
    }
}
int main()
{
    int n, i;

    scanf_s("%d", &n);
    for (i = 0; i<n; i++) {
        printf("Enter first name:");
        scanf_s("%s", s[i].first);

        getchar();
        printf("Enter last name:");
        gets( s[i].last);   
        printf("Enter ID:");
        scanf_s("%d", &s[i].id);
        printf("Enter CGPA: ");
        scanf_s("%f", &s[i].cgpa);
    }

    first_numbers(n);

    return 0;
}

asked 03 Nov, 08:43

mahbubhimel's gravatar image

mahbubhimel
212

edited 03 Nov, 12:10

Mosharraf%20Hosain's gravatar image

Mosharraf Hosain ♦
9618


আমি কোড রান করে দেখলাম ঠিক ভাবেই কাজ করছে । আপনি scanf_s এর পরিবর্তে scanf ব্যবহার করেন ।

permanent link

answered 03 Nov, 08:51

menon's gravatar image

menon
3.9k222

ভাই ভিজুয়াল স্টুডিওতে scanf_s চায়। নাহলে এরর দেখায়।

(03 Nov, 08:54) mahbubhimel
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×355
×5
×2

question asked: 03 Nov, 08:43

question was seen: 73 times

last updated: 03 Nov, 12:11