Computer Science, asked by turesuelveautop4187, 10 months ago

If multiple conditions are used in a single if statement then the testing of those conditions are done from

Answers

Answered by sonu4339
2

I know it will take care about this email

Answered by lovingheart
0

Answer:

Use “and” or “or” operator

Explanation:

Syntax:

using “and”

if(condition 1 and condition 2 and condition 3 and …..and condition n)

{

…..

}

else

{

….

}

Using “or”

if(condition 1 or condition 2 or …… or condition n)

{

….

}

else

{

….

}

Example:

Using “and”

if(n%2!=0 and n%3!=0 and n%5!=0 and n%9!=0 and n%7!=0)

{

printf(“prime”);

}

else

{

printf(“not prime”);

}

Using “or”

if(n%2==0 or n%3==0 or n%5==0 or n%9==0 or n%7==0)

{

printf(“not prime”);

}

else

{

printf(“prime”);

}

Similar questions