You are currently viewing Basics of while loop in c vs python
Basics of while loop in c vs python

Basics of while loop in c vs python

Spread the love

The python while loop allows a part of the code to be executed until the given condition return false.

I python we use following loop control statements:

  1. Continue Statements
  2. Break Statements
  3. Pass Statements

Basics of while loop in python

Syntax of while loop

while expression:
Statements
i=1
while(i<=10):
print(i)
i=i+1
###output
1,2,3,4,5,6,7,8,9,10

Basics of while loop in c

Basics of while loops

Syntax of while loop

while(Condition){
Statements}
#include<stdio.h>
int main()
{
    int i=1;
    while(i<=10)
    {
        printf("%d",i);
        i++;
    }return 0;
}

In this program we declared i variable inside the main function and use while loop condition.

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