C program to take user input to an array and show its content.

In this program, we take some input to an array and then show its content.

#include <stdio.h>

int main()
{
  int arr[5];   // array
  int i; // loop var

  printf("Enter elements of the array - \n");

  for(i=0;i<5;i++)
  {
    scanf("%d",&arr[i]);
  }

  printf("Content of the array - \n");

  for(i=0;i<5;i++)
  {
    printf("%d \n",arr[i]);
  }

  return 0;
}
OUTPUT:
Enter elements of the array -
5
10
15
20
25
Content of the array -
5
10
15
20
25

Related Post

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.