C Programming

Two Array Sum

Learn c programming for calculate sum of two array and store in another array

6/6/2018
0 views
two-array-sum.cC
#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
C languageC programmingsum of two array

Related Examples

Mashable is a global, multi-platform media and entertainment company For more queries and news contact us on this
Email: info@mashablepartners.com