2351 Views

17. Explain various conditional statements in C language.


freefire2411a 12th Feb, 2022
Answers (2)
Nisha 12th Feb, 2022
hey there

Conditional Statements in C programming are used to make decisions based on the conditions. Conditional statements execute sequentially when there is no condition around the statements.
the different types of conditional statements are available in C language.

  1. if statement
  2. if else
  3. Nested if-else
  4. if-else-if
  5. switch



If statement

It is one of the powerful conditional statement. If statement is responsible for modifying the flow of execution of a program. If statement is always used with a condition. The condition is evaluated first before executing any statement inside the body of If.

if-else statement

The if-else statement in C language is used to execute the code if condition is true or false. It is also called two-way selection statement.

nested if...else

The nested if...else statement is used when a program requires more than one test expression. It is also called a multi-way selection statement. When a series of the decision are involved in a statement, we use if else statement in nested form.

if-else-if

The if-else-if statement is used to execute one code from multiple conditions. It is also called multipath decision statement. It is a chain of if..else statements in which each if statement is associated with else if statement and last would be an else statement.

Switch Statement

switch statement acts as a substitute for a long if-else-if ladder that is used to test a list of cases. A switch statement contains one or more case labels which are tested against the switch expression. When the expression match to a case then the associated statements with that case would be executed.

Sumedha Bhattacharya 12th Feb, 2022

Dear Student,


There are different types of conditional statements are available in C language .

  1. if-else
  2. Nested if-else
  3. if-else-if
  4. switch
  • If-else

when any condition is given in if block .. if the condition is true , the statements under if block will work .. otherwise the else block statement will execute.

  • Nested if-else

If under any if statement , there is another (one or more) if statement/s are present .. then the scenario is called nested if-else .

  • If-else-if

this condition works when we have to check more than one condition individually .

  • Switch

This statement works for individual cases that are given at the time of building the code.


For more details about C programming , refer this :

https://www.careers360.com/courses-certifications/udemy-c-programming-from-scratch-master-course

Hope this helps!


Related Questions

Amity University, Noida Law A...
Apply
Admissions open for B.A. LL.B (Hons) , B.A. LL.B , BBA LL.B.(Hons) , B.Com.LL.B. (Hons.)
Jindal Global Law School Admi...
Apply
Ranked #1 Law School in India & South Asia by QS- World University Rankings | Merit cum means scholarships | Application Deadline: 31st Jan'25
TAPMI Jaipur MBA Admissions 2025
Apply
67 Years of Established Legacy | Ranked #79 in India by NIRF | Among the only few top 100 B-Schools currently accepting applications
UPES Integrated LLB Admission...
Apply
Ranked #28 amongst Institutions in India by NIRF | Ranked #1 in India for Academic Reputation by QS University Rankings | 16.6 LPA Highest CTC
Chandigarh University Admissi...
Apply
Ranked #1 Among all Private Indian Universities In QS Asia Rankings 2025 | Scholarships worth 210 CR
Great Lakes PGPM & PGDM 2025
Apply
Admissions Open | Globally Recognized by AACSB (US) & AMBA (UK) | 17.3 LPA Avg. CTC for PGPM 2024 | Application Deadline: 1st Dec 2024
View All Application Forms

Download the Careers360 App on your Android phone

Regular exam updates, QnA, Predictors, College Applications & E-books now on your Mobile

150M+ Students
30,000+ Colleges
500+ Exams
1500+ E-books