#Program 1: print n times(increment)
n=int(input("Enter the value of n : "))
for i in range(1,n,1): #i=1,i<n,i++
print(i," jahab")
#Program 2: print n times(increment)
n=int(input("Enter the value of n : "))
for i in range(1,n+1,1): #i=1,i<=n,i++
print(i," jahab")
#Program 3: print n times(decrement)
n=int(input("Enter the value of n : "))
for i in range(n,0,-1): #i=n,i>0,i--
print(i," jahab")
#Program 4 : Display even number in given input
n=int(input("Enter the value of n : "))
for i in range(2,n+1,2):
print(i)
#Program 5 : Display even number in given input
n=int(input("Enter the value of n : "))
for i in range(1,n+1,1):
if (i%2==0):
print(i)
#Program 6 : Display even number & sum of even in given input
n=int(input("Enter the value of n : "))
s=0
for i in range(1,n+1,1):
if (i%2==0):
s=s+i
print(i)
print("sum of even number is :",s)
#Program 7 : sum of digits
n=int(input("Enter the value of n : "))
s=0
for i in range(1,n+1,1):
s=s+i
print(i)
print("sum of Digits :",s)
#Program 8 : find factorial value
n=int(input("Enter the value of n : "))
s=1
for i in range(1,n+1,1):
s=s*i
print(i)
print("Factorial is :",s)
#Program 9 : display n times using while loop(increment)
n=int(input("enter the value of n : "))
i=1
while(i<=n):
print(i," jahab")
i=i+1
#Program 10 : display n times using while loop(decrement)
n=int(input("enter the value of n : "))
i=n
while(i>=1):
print(i," jahab")
i=i-1
#Program 11: Reversed number
n=int(input("enter the value of n : ")) #123
c=0
while(n>0): #123>0 ,12>0, 1>0,0>0
a=n%10 #3,2,1
n=int(n/10) #12,1,0
c=c*10+a #3,32,321
print("Reverse number is :",c)
#Program 12: sum of integer(123 : 1+2+3 = 6)
n=int(input("enter the value of n : ")) #123
c=0
while(n>0): #123>0 ,12>0, 1>0,0>0
a=n%10 #3,2,1
n=int(n/10) #12,1,0
c=c+a
print("sum of integer is :",c)
#Program 13: Armstrong number(153 = 1(3)+5(3)+3(3) =153)
n=int(input("enter the value of n : ")) #123
n1=n
c=0
while(n>0):
a=n%10
n=int(n/10)
c=c+a*a*a
print("Input :",n1,"\t Output :",c)
if c==n1:
print("Armstrong Number")
else:
print("Not Armstrong Number")
#note: 153,370,371,407
1. Perfect Number or not
2. Middle number is equal to sum of first and last number
3. Adam number or not Adam
------------------------------------------------------------------------------
#Program 1 : using nested for loop using increment
n=int(input("Enter the value of n : "))
for i in range(1,n+1):
for j in range(1,i+1):
#print(i,end="")
print(j,end="")
print()
#Program 2 : using nested for loop using decrement
n=int(input("Enter the value of n : "))
for i in range(n,0,-1):
for j in range(1,i+1):
#print(i,end="")
print(j,end="")
print()
#Program 3 : using nested for loop using decrement
n=int(input("Enter the value of n : "))
for i in range(1,n+1):
for j in range(n,i-1,-1):
print(i,end="")
#print(j,end="")
print()
==========================================================