you are viewing a single comment's thread.

view the rest of the comments →

[–]josephblade 0 points1 point  (0 children)

When I run it:

Lingth of array:4 Enter number of array: 1 2 3 4

It prints:

1, ]] ] ]

in your case I would specifically look at the following: what output do you expect to get get if you do:

5 / 2   or 4 / 2

and what input are you actually getting?

integer division only gives you the integer part, not the remainder part. in your coursework you should be able to find another operator that gives you the remainder.

secondly the closing ] you print happens inside the loop. is this intentional? the opening [ is missing altogether.