While Loop in Python Part – 1

Master Python with 70+ Hands-on Projects and Get Job-ready - Learn Python

Program 1

# i=1 # intializtion
# while(i<=10): # condition
#     print(i)
#     i+=1 # increment

# Table of a Number
# n=int(input("Enter a number"))
# # i=1 # intializtion
# while(i<=10): # condition
#     print(i)
#     i+=1 # increment

# n=int(input("Enter the limit"))
# i=1 # intializtion
# while(i<=n): # condition
#     print(i*i)
#     i+=1 # increment

# i=10 # intializtion
# while(i>=1): # condition
#     print(i)
#     i-=1 # increment

# n=int(input("Enter the limit"))
# i=1
# sum=0
# while(i<=n):
#     print(i)
#     sum=sum+i
#     i+=1

# print("Sum of series: ",sum)

# 1-2+3-4+5-6  ..............+-n

# n=int(input("Enter the limit"))
# i=1
# sum=0
# while(i<=n):
#     if(i%2==0):
#         sum=sum-i
#     else:
#         sum=sum+i

#     i=i+1                    
# print("Sum of series: ",sum)

 

Your 15 seconds will encourage us to work even harder
Please share your happy experience on Google

courses

DataFlair Team

DataFlair Team provides high-impact content on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. We make complex concepts easy to grasp, helping learners of all levels succeed in their tech careers.

Leave a Reply

Your email address will not be published. Required fields are marked *