C Program to Perform Array Basic Operations

In this program, you'll learn to perform basic operations on Array.



Source Code
#include<stdio.h>

int main()
{
    int a[10], i;
    printf("Enter 10 array elements\n");
    /* Input array elements */
    for(i=0; i<10; i++)
        scanf("%d", &a[i]);

    /* Modify array elements */
    for(i=0; i<10; i++)
    {
        a[i] = a[i] + 1;
    }

    /* Printing array elements */
    printf("After modifying array elements are\n");
    for(i=0; i<10; i++)
    {
        printf("%2d ", a[i]);
    }
    return 0;
}
Output
Enter 10 array elements
45 21 32 50 12 47 23 65 4 9

After modifying array elements are
46 22 33 51 13 48 24 66  5 10