Sunday, August 19, 2018

STORE AND RETRIEVE

  • Problem Description

    Store and retrieve elements from an array
  • CODING ARENA::
  • #include <stdio.h>
    int main()
    {
      int a,b[100],i;
      scanf("%d",&a);
      for(i=0;i<a;i++)
      {
        scanf("%d",&b[i]);
        printf("element %d=%d\n",i,b[i]);
      }

    return 0;
    }
  • Test Case 1

    Input (stdin)
    5
    
    10 20 30 50 40
    
    
    Expected Output
    element 0=10
    
    element 1=20
    
    element 2=30
    
    element 3=50
    
    element 4=40
  • Test Case 2

    Input (stdin)
    4
    
    10 20 30 40
    
    
    Expected Output
    element 0=10
    
    element 1=20
    
    element 2=30
    
    element 3=40

No comments:

Post a Comment