Wed Jun 06 2018

Two Array Sum

C Programming2697 views

File Name: two-array-sum.c

#include<stdio.h>

int main() {

	/* Declaration of 3 arrays with 10 memory location */
	int a[10], b[10], c[10], i;
	printf("Enter first 10 number:\n");
	for(i = 0; i < 10; i++)
		scanf("%d",&a[i]);
	printf("Enter second 10 number:\n");
	for(i = 0; i < 10; i++)
		scanf("%d",&b[i]);
	printf("Sum of two array is:\n");
	for(i = 0; i < 10; i++) {
		c[i] = a[i] + b[i];
		printf("%d\n",c[i]);
	}
	return 0;
}



/* Output */
Enter first 10 number:
1
2
3
4
5
6
7
8
9
10

Enter second 10 number:
4
4
4
4
4
4
4
4
4
4

Sum of two array is:
5
6
7
8
9
10
11
12
13
14
Reference:

We use cookies to improve your experience on our site and to show you personalised advertising. Please read our cookie policy and privacy policy.