Add two array

C Program to Add two array : -

Program : -

 

#include<stdio.h>
#include<conio.h>
#include<string.h>

void main()
 { 
    int a[5],b[5],c[5],i,j;
    clrscr();
    puts("Enter the first array element :");
    for(i=0;i<5;i++)
    {
        scanf("%d",&a[i]);
    }

    puts("Enter the second array element :");
    for(i=0;i<5;i++)
    {
        scanf("%d",&b[i]);
    }

    puts("The third array element is :");
    for(i=0;i<5;i++)
    {
        c[i]=a[i]+b[i];
        printf("%d  ",c[i]);
    }
    getch();
 }
 

Output : -

Enter the firat array element : 1 2 3 4 5

Enter the second array element : 5 4 3 2 1

The third array element is : 6 6 6 6 6