Posts

Only even numbers between 0 to 100 using for loop

Image
# Write a program to print only even numbers between 0 to 100 using for loop  for x in range(100):     # Here Check if x is odd     if x % 2 == 1:         continue     print(x)   output:    

Find odd numbers between 1 to 100 using for loop

Image
 # Write a program to print only odd numbers between 1 to 100 using for loop for x in range(100):     # Here Check if x is even     if x % 2 == 0:         continue     print(x) Output: 

Natural ten numbers using for loop

Image
# Write a program to print natural ten numbers using for loop no=0     #Here no is variable for no in range(10):    no = no + 1    print(no) Output:  

Reverse natural number using while loop

Image
#Write a program to print 100 to 1 reverse natural numbers using while loop     no = 100 while (no>= 1):    print(" ", no)    no = no - 1 Output:  

Positive or negative number program using nested if-else

Image
  #Write a program to input any number and find out given number is positive or negative using nested if-else num = float(input("Enter any number: ")) if num >= 0:     if num == 0:         print("Given number is Zero")     else:         print("Given number is Positive Number") else:     print("Given number is Negative Number") Output: