Computer Science, asked by WKumarJnv, 1 year ago

Describe "if" statement. Write an "if" statement to multiply even number by 3 and odd number by 4?

Answers

Answered by FemSam3362
1
"If" statement is a conditional/ selection statement which tests a particular condition. If the condition evaluates to true, a statement or a set of statements is executed otherwise the course of action is ignored. 'If' statement is usually followed by a 'else' statement. It is not necessary for an 'if' to be followed by an 'else'. ( 'If' statement can stand alone but 'else' statement must always have a 'if' statement prefixed to it.)

if( x%2==0)
x =x*3;
else
x=x*4;

WKumarJnv: Thank you so much for it...
Similar questions