We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
you dont need to add (n%2==0) in
if(n%2==1 || ( (n%2==0) && (n>=6 && n <= 20 ) ) ) statement
as it is not to checking whether the number is even.
we need to check only that number is odd so (n%2==1) is important and number is in bitween 6 to 20.
if this doesnot follow go to direct else statement.
i ran without (n%2==0) statement and it ran perfectly.
Java If-Else
You are viewing a single comment's thread. Return to all comments →
you dont need to add (n%2==0) in if(n%2==1 || ( (n%2==0) && (n>=6 && n <= 20 ) ) ) statement as it is not to checking whether the number is even. we need to check only that number is odd so (n%2==1) is important and number is in bitween 6 to 20. if this doesnot follow go to direct else statement. i ran without (n%2==0) statement and it ran perfectly.