Get Update on recent Technology & Programming

Tuesday, 7 November 2017

C Program to input values into an array and display them

Posted by   on Pinterest


#include<stdio.h>

int main(void)

{

 int arr[5],i;

 for(i=0; i<5; i++)

 {

  printf("Enter a value for arr[%d] : ",i);

  scanf("%d",&arr[i]);

 }

 printf("The array elements are : \n");

 for(i=0; i<5; i++)

  printf("%d\t",arr[i]);

 printf("\n");

 return 0;

}

No comments:
Write comments

Hey, we've just launched a new custom color Blogger template. You'll like it -
Join Our Newsletter