Thursday, September 13, 2018

SIMPLE STRUCTURES

  • Problem Description

    Write a C program to Store Information and Display it Using Structure
  • CODING ARENA
  • #include <stdio.h>
    int main()
    {
      struct student
      {
        char name[80];
        int rollno;
        float marks;
      };
      struct student s;
      scanf("%s",s.name);
      scanf("%d",&s.rollno);
      scanf("%f",&s.marks);
      printf("Name=%s\n",s.name);
      printf("Roll number=%d\n",s.rollno);
      printf("Marks=%.1f\n",s.marks);
      return 0;
    }
  • Test Case 1

    Input (stdin)
    Abi
    
    1001
    
    99.5
    
    
    Expected Output
    Name=Abi
    
    Roll number=1001
    
    Marks=99.5
  • Test Case 2

    Input (stdin)
    Akash
    
    1002
    
    90.3
    
    
    Expected Output
    Name=Akash
    
    Roll number=1002
    
    Marks=90.3

No comments:

Post a Comment