EmbLogic's Blog

Write a c program to add two array of size 10 and store the sum into third array

#include
int main()
{
int i,a[10],b[10],c[10];
printf(“Enter the element of array1:\n”);
for(i=0;i<10;i++)
{
scanf("%d",&a[i]);
}
printf("Enter the element of array2:\n");
for(i=0;i<10;i++)
{
scanf("%d",&b[i]);
}
printf("Element of array3 are:\n");
for(i=0;i<10;i++)
{
c[i]= a[i]+b[i];
printf("a[%d]+b[%d]=%d\n",i,i,c[i]);
}
}

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>