C Program to implement 1D array.

C Program to implement 1D array.

 
 #include <stdio.h>



int main(){
    int array[100], n, sum=0;
    printf("Enter the length of an array :");
    scanf("%d", &n);
    printf("Enter %d numbers to array :", n);
    for (int i = 0; i < n; i++)
    {
        scanf("%d", &array[i]);
        sum+=array[i];
    }
    printf("The numbers are: ");
    for (int i = 0; i < n; i++)
    {
        
        printf("%d ", array[i]);
        
    }
    printf("\nThe sum is : %d ", sum);
    
    
    

    return 0;
} 
 

OUTPUT: