C program to read and print one dimensional array

                            In this program we will read 10 integers and then we will print them. To read the element of an array we will run ‘for’ loop from 0 to 9 because the index of an array always starts with 0. 


#include<stdio.h>              
#include<conio.h>
void main ()
{
int a[10],i;
clrscr();
printf("Enter 10 integer values : \n");
   for(i=0;i<=9;i++)
       {
        scanf("%d",&a[i]);
        }
printf("Entered Array values are : \n");
        for(i=0;i<=9;i++)
             {
              printf("%d \t",a[i]);
             }
getch();
}

=================================
OUTPUT:-

Enter 10 integer values :
1 2 3 4 5 9 8 7 6 5                                                            
Entered Array values are :                                                      
1       2       3       4       5       9       8       7       6       5   

  ================================


C program to read and print one dimensional array

Comments