Write a C program that inputs 5 elements into each of 2 inte

Write a C program that inputs 5 elements into each of 2 integer arrays. Add corresponding array elements, that array1 [0] + array2[0], etc. Save the sum into a third array called sumArray[]. Display the sum array. Submit your and the input and output of the complete execution.

Solution

Answer:

#include<stdio.h>
#include<conio.h>
void main()
{
int i,array1[5],array2[5],SumArray[5];
clrscr();
printf(\"\ Reading the first array\ \");
for (i=0;i<5;i++)
{
printf(\"Enter the values\");
scanf(\"%d\",&array1[i]);
}
printf(\"\ Reading the second array\ \");
for (i=0;i<5;i++)
{
printf(\"Enter the values\");
scanf(\"%d\",&array2[i]);
}
printf(\"\ The result of addition of two arrays is :\ \");
for(i=0;i<5;i++)
{
SumArray[i]=array1[i]+array2[i];
printf(\"\ sum of %d & %d is %d\",array1[i],array2[i],SumArray[i]);
}
getch();
}

 Write a C program that inputs 5 elements into each of 2 integer arrays. Add corresponding array elements, that array1 [0] + array2[0], etc. Save the sum into a

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site