Can you give an example of input and output?
Why does an increment input of zero break your first for loop? -- this will lead to you accessing uninitialized data (that's bad).
If I understand correct, you're saying an input of [1, 2, 3, 4, 5] and increments [1, 2, 3, 4, 5] should produce an output of [2, 4, 6, 8, 10]?
Seems to work for me...
Enter the size of the Array
5
Please Enter the number you want the increment to be.
1
2
3
4
5
Please Enter the numbers for the array
1 2 3 4 5
2
4
6
8
10 |
But again, I would remove the
1 2 3
|
if (inc[i] == 0) {
break;
}
|
because you don't have any logic further down to handle the loop breaking early.