0% found this document useful (0 votes)
18 views2 pages

C Array

The document contains code to add elements of two arrays and output the sum of corresponding elements. It takes input length and elements of two arrays, adds corresponding elements and outputs the sum array.

Uploaded by

riju
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views2 pages

C Array

The document contains code to add elements of two arrays and output the sum of corresponding elements. It takes input length and elements of two arrays, adds corresponding elements and outputs the sum array.

Uploaded by

riju
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

#include<stdio.

h>

#include<conio.h>

main()

int a[50],b[50],c,d,sum[50];

clrscr();

printf("Enter array length: ");

scanf("%d",&c);

printf("\nEnter %d elements for a[]:\n",c);

for(d=1;d<=c;d++)

scanf("%d",&a[d]);

printf("\nEnter %d elements for b[]:\n",c);

for(d=1;d<=c;d++)

scanf("%d",&b[d]);

printf("\n a[] \t b[] \t a[]+b[]");

for(d=1;d<=c;d++)

sum[d]=a[d]+b[d];
printf("\n %d \t %d \t %d",a[d],b[d],sum[d]);

getch();

You might also like