This is what I have so far and was done on MS Visual Studio 05 in C++ settings:Write a program that begins by defining the arrays
int integer1 [ 5 ];
int integer2 [ 5 ];
int sum [ 6 ];
The program asks for five single-digit integers (selected form {0, 1, …, 9}, repetitions
allowed). As the program reads the digits, it stores each in one of integer1's cells.
Next, the program asks for and stores in integer2 five more single-digit integers. The
program then treats each array as if it represented a single integer. For example, if we
read 2, 3, 0, 3, 5 into integer1, the integer1 is interpreted as the fine-digit integer
23,035. The program adds the five-digit integers integer1 and integer2 and stores the
sum in the array sum. (The array sum has one more cell than do the other two so that it
can hold a carry.)
Code: Select all
#include "stdio.h"
#include "math.h"
void main()
{ int integer1[5];
int integer2[5];
int sum[6];
int i, j;
for(i=0;i<=4;i++){
printf("Type in a digit from 0-9 for the first five digit number.\n");
scanf("%d", &integer1[i]);
}
for(j=0;j<=4;j++){
printf("Type another digit from 0-9 for the second five digit number\n");
scanf("%d", &integer2[j]);
}
sum[i+1]=integer1[i]+integer2[j];
printf("The sum is %d\n", sum[i+1]);
}