You are currently viewing If-else Statements in C VS Python
IF-Else in c vs python

If-else Statements in C VS Python

Spread the love

We know that decision making is the most important concept of all the programming languages. Condition making is the one of the important aspect of decision making.

Three kind of statements

  1. If statements
  2. If-else statements
  3. Nested if statements

If Statements

The if statements is used to test a specific condition. If condition is true, a block of code (if-block) will be executed.

If-else sttements

The if-else statements is similar to if statement but it also provide the block of the code for the false case of the condition to be checked.

Nested if statements

Looking of statements inside another loops

If Statements in python

Syntax for if statements

if expression:

Python code for if statements

if num%2==0:

If-else statements in c

IF-Else in c vs python
IF-Else in c vs python

Syntax for if-else statements

//code to be executed
int number;
int main()
    printf("Enter the number:\n");
        printf("This is even number");}
        else printf("This is odd number");

In this c program we declared number as a input variable for if else statements. Use simple if else logic to print even or odd number.


In this article we saw How to if statements id different for both languages (i.e. c and python)

sachin Pagar

I am Mr. Sachin pagar Embedded software engineer, the founder of Sach Educational Support(Pythonslearning), a Passionate Educational Blogger and Author, who love to share the informative content on educational resources.

Leave a Reply