(PP-1)
1A.Write a python program for simple calculator.
a=int(input("Enter a the first number:"))
b=int(input("Enter a the second number:"))
print("Addition:",a+b)print("Subtraction:",a-b)
print("Multiplication:",a*b)
print("Division:",a/b)1B.Write a python program to check whether the number is positive or negative.
a=int(input("Enter the number:"))if(a>0): print("The Entered Number Is Positive") else: print("The Entered Number Is Negative")1C.Write a python program to find factorial of a number.a=int(input("Enter the number:"))
fact=1
for i in range(1,a+1): fact=fact*iprint(fact)1D.Write a python program to find fibonacci series.n=int(input("Enter the number:")) a=-1 b=1 for i in range(0,n+1): c=a+b a=b b=cprint(c)1E.Write a python program to check whether it is palindrome or not.n=int(input("Enter the number:")) number=n reverse=0 remainder=0 while n!=0: remainder=n%10 reverse=reverse*10+remainder n=int(n/10) if(reverse==number): print("Given number is a palindrome") else:print("Given number is not a palindrome")1F.Write a python program to reverse the user-defined value.n=int(input("Enter the number:")) reverse=0 remainder=0 while n!=0: remainder=n%10 reverse=reverse*10+remainder n=int(n/10)print(reverse)1G.Write a python program to find armstrong number.n=int(input("Enter the number:")) number=n reverse=0 sum=0 while n!=0: reverse=n%10 sum=sum+reverse**3 n=int(n/10) if(sum==number): print("Given number is an Armstrong") else:print("Given number is not an Armstrong")1H.Create a program that asks the user to enter their name and their age. Print out a message addressed to them that tells them the year that they will turn 100 yearsold.name=(input("Enter the name:")) age=int(input("Enter the age:")) currentyear=int(input("Enter the current year:")) hundred=currentyear+(100-age)print(hundred)
Comments
Post a Comment