C program to Create an Array and Print it Elements

Write a  C program to Create an Array and Print it Elements:


Required Knowledge:

C basics, Arrays

Program:

 1 #include<stdio.h>
 2  
 3  void main()
 4  {
 5      int array[5];
 6  
 7      int i;
 8  
 9      for(i=0; i<=4; i++)
10      {
11          printf("Enter the number %d:",i+1);
12          scanf("%d",&array[i]);
13      }
14  
15      printf("The numbers you entered are:\n");
16  
17      for(i=0; i<=4; i++)
18  
19      {
20          printf("%d\n",array[i]);
21      }
22  
23  }

Output:



Enjoy it........

Comments

Popular posts from this blog

C program to calculate velocity

C program to find square root of a number

C program to find maximum between two numbers