I dint understand how to organize the lines
when to put while condition
when to put while
when to put if condition
I dint understand how to organize the lines
when to put while condition
when to put while
when to put if condition
can you explain me the criteria
@nadipally.preetha
An if
statement checks if an expression is true or false, and then runs the code inside the statement only if it is true. The code inside the loop is only run once …
if (x > y)
{
// this will only happen once
}
A while
statement is a loop. Basically, it continues to execute the code in the while statement for however long the expression is true.
while (x > y)
{
// this will keep happening until the condition becomes false.
}
but how did you decide in the pattern problem when to put an if statement and when to put while condition
I dint understand how to organize the steps
use while to iterate till last row or column and use if statement to check what you want to print.