0 0

C programming if else statement

- Advertisement -
Read Time:1 Minute, 11 Second
C programming if else statement
C programming if else statement

C programming if else statement

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. If you put some condition for a block of statements, the execution flow may change based on the result evaluated by the condition. This process is called decision making in ‘C’ programming.

If-else Statement

The if-else statement is used to run two operations for a single condition. The if-else statement is an extension to the if statement using which, we can perform two different operations, i.e., one is for the correctness of that condition, and the other is for the incorrectness of the condition. Here, we must notice that if and else block cannot be executed simultaneously. Using if-else statement is always preferable since it always invokes an otherwise case with every if condition. The syntax of the if-else statement is given below.

If else Program using c programming:

#include<stdio.h>
int main()
{
int age;
printf("Enter age:");
scanf("%d", &age);

if (age > 18)
{
printf("Adult");
}

else
{
printf("Not adult");
}
return 0;
}

Leap year program in C using if else

BASIC C PROGRAMMING CONCEPT AND PROGRAMS: HELLO WORLD, ADDING TWO INTEGERS, AREA OF SQUARE AND CIRCLE USING VS CODE

Happy
Happy
0 %
Sad
Sad
0 %
Excited
Excited
0 %
Sleepy
Sleepy
0 %
Angry
Angry
0 %
Surprise
Surprise
0 %
- Advertisement -

Follow US!

FansLike
FollowersFollow
FollowersFollow
SubscribersSubscribe

Latest Post

Introduction to Online Analytical Processing and Data Mart

Introduction to Online Analytical Processing and Data Mart

Introduction to Online Analytical Processing and Data Mart Online Analytical Processing OLAP is computer processing that enables a user to easily and selectively extract and view...
A data warehouse is a relational database that is designed for query and analysis rather than for transaction processing

Introduction to Data Warehouse

Introduction to Data Warehouse A data warehouse is a relational database that is designed for query and analysis rather than for transaction processing. It usually...
Introduction to Advance Database System

Introduction to Advance Database System

Introduction to Advance Database System ABSTRACT Data is collection of raw facts and figure which is basic for decision making. Anything which is unorganized is called...
What is Ternary Operator in C programming with example

What is Ternary Operator in C programming with example

What is Ternary Operator in C programming with example Ternary Operator In the C language ternary operator is allowing for executing or running any code based...
C program to check student is pass or fail using if else, nested if and ternary operator.

What is Conditional Statement in C programming

What is Conditional Statement in C programming Conditional Statement Conditional Statements in C programming are used to make decisions based on the different conditions. Conditional statements...
Types of instruction in C programming

Types of instructions in C programming

Types of instructions in C programming: C Instructions C instructions are the commands in the program that instructs the compiler to do certain action. Basically it...