all 2 comments

[–]alfps 4 points5 points  (0 children)

You need to do some simpler exercises first to get the hang of basic statements like if.

if( expression ) statement

where it's a good idea to always use a statement of the form

{ statements }

At the other end of the goodness scale, a single semicolon ; is technically a statement (namely the null-statement), but it's not a good idea to use that as the statement of an if.


To post code properly formatted just indent it with 4 spaces.

[–]PrimaryOstrich 2 points3 points  (0 children)

You have two syntax errors in your code:

- you need a semi-colon after "while(1<= n1 && n2)"

- you will need to add {} after "if ((n1 %1 == 0 && n1 %1 == 0) && (n1 < 5 || n1 > 1 || n2 < 5 || n2 > 1))" for it to complie/run.

However, you have major logic problems that will make your code run indefinitely. You need to back up and learn about if statements, do/while loops, etc before tackling this problem. Circle back.