C Program To Print All Value Of An Array

#include <stdio.h>
void  main()
{
    int arr[10];
    int i;
       printf("\n\nRead and Print elements of an array:\n");
       printf("-----------------------------------------\n");
    printf("Input 10 elements in the array :\n");
    for(i=0; i<10; i++)
    {
	    printf("element - %d : ",i);
        scanf("%d", &arr[i]);
    }
    printf("\nElements in array are: ");
    for(i=0; i<10; i++)
    {
        printf("%d  ", arr[i]);
    }
    printf("\n");
}

Output:

Enter 5 words: R programming
JavaScript
Java
C programming
C++ programming
In the lexicographical order:
C programming
C++ programming
Java
JavaScript

Leave a Comment