Use app×
Join Bloom Tuition
One on One Online Tuition
JEE MAIN 2025 Foundation Course
NEET 2025 Foundation Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
0 votes
880 views
in Computer by (46.7k points)

What are selection statements? Write the syntax for different types of selection statements.

1 Answer

+1 vote
by (38.6k points)
selected by
 
Best answer

Selection statements are used to execute certain blocks of statements by evaluating the condition.

if(condition)

{

statement 1;

statement 2;

statement n;

}

Syntax of if-else statement

if(condition)

{

statement 1;

....

statement n;

else

{

statement 1;

....

statement n;

}

Syntax of if-else-if (nested) statement

If(expression)

{

statements

}

else if(expression)

{

statements

}

Syntax of switch statement

switch(expression)

{

case constant 1:

statements

break

case constant 2:

statements

break

.

.

default

statements

}

No related questions found

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

Categories

...