Computer Science, asked by himu95, 1 year ago

difference between If else If and switch case

Answers

Answered by Tamash
29
Hey mate here is ur... query...

*******************

If-else” and “switch” both are selection statements.

Let’s see some differences below,

IF-ELSE

statement will be executed depend upon the output of the expression inside if statement.It using multiple statement for multiple choices.if statement evaluates integer, character, pointer or floating-point type or boolean type.

SWITCH CASE

statement will be executed is decided by user.It using single expression for multiple choices.Switch statement evaluates only character or integer value

if

Syntax of if statement:
The statements inside the body of “if” only execute if the given condition returns true. If the condition returns false then the statements inside “if” are skipped.

"""""""""""""""""

Hope this will help you

Tamash: thank u soo much himu...
himu95: no need
Tamash: o really, by the way nice dp
Answered by amaan88
35
If-else” and “switch” both are selection statements.

Let’s see some differences below,

IF-ELSE

▪statement will be executed depend upon the output of the expression inside if statement.
▪It using multiple statement for multiple choices.
▪if statement evaluates integer, character, pointer or floating-point type or boolean type.

SWITCH

▪statement will be executed is decided by user.
▪It using single expression for multiple choices.
▪Switch statement evaluates only character or integer value.

I hope it will help uh..

I think you are from icse 10th.
Similar questions