HIGH ORDER THINKING PROGRAM



#Now we will learn how to do more programming of high order level
#So here we will do like program to solve the series

Q.Write a program to provide menu bar to select to do operation


""""WAP To Provide menu bar to print operation that the user want by his choice"""

n1=int(input("Enter a first numbers:"))         #n1 is first number  
n2=int(input("Enter a second number:"))         #n2 is second number
   
#here the menu bar to select the choice by the user
     
print("1.Sum of the numbers")
print("2.Substraction of the number.")
print("3.Multiplication of the number.")
print("4.Floor division of the number.")
print("5.Modulus of the number.")
print("6.Square of the two numbers .")

choice=int(input("Enter your choice:"))
if choice==1:
    print("Sum of the numbers:",n1+n2)
elif choice==2:
    print("Substraction of the numbers:",n1-n2)
elif choice==3:
    print("Multiplication of the numbers:",n1*n2)
elif choice==4:
    print("Floor division of the number:",n1//n2)
elif choice==5:
    print("Modulus of the two numbers are:",n1%10 ,"and",n2%10)
elif choice==6:
    print("Squares of the two numbers:",n1**2 ,"and",n2**2)
else:
    print("Your Have not selected any choice.")


Q. Write a program to print sum of the series


"""
@ author:name
Date: XX MN YEAR
"""
"""
X+X^2/2!+X^3/3!+.......+X^N/N?
"""


X=eval(input("Enter a value for X:"))
N=eval(input("Enter a positive integer number:"))

sum=0
fact=1
for i in range(1,N+1):
fact=fact*i
sum=sum+(X**i)/fact
print("Sum of the given series is:",sum)


Q.Write a program to check whether single character is lowercase or upper case alphat or numeric



"""WAP to print to check  whether your single character is uppercase or lowercase alphabet or number or any symbol"""


s=input("Enter a single:")
print(s)

if s>='A' and s<='Z':
    print("Your character is alphabet and in capital letter.")
elif s>='a' and s<='z':
    print("Your character is in lowercase alphabet.")
elif s>='0' and s<='9':
    print("Your character is numeric.")
else:
    print("Your character is any  symbol.")


Q.Write a program to print sum of the   given  series   


"""Write a program to print sum of the   series       
1+1/1!+1/2!+1/3!+................+1/N!
 

N=3
1+1/2!+1/3!=1+0.5+0.16=1.65

"""

N=eval(input("Enter a value of N:"))
sum=0
fact=1
for i in range(1,N+1):
    fact=fact*i
    sum=sum+(1/fact)
print("Sum of the series:",sum)




OUTPUT:
>>>Enter a value of N:4
>>>Sum of the series:1.7083333333333335




Q.Write a Program To print sum of the series 



""""WAP To print sum of the series  
x+X^2/2+X^3/3+.............+x^N/N
x=2
N=2

2+2^2/2+2^3/3
=2+4/2+8/3=2+2+2.6=6.6

"""


   
X=int(input("Enter a value for x:"))
N=int(input("Enter a value of N:"))
sum=0

for i in range(1,N+1):
    sum=sum+(X**i)/i
print("Sum of the series is:",sum)




Q.Write a program to print sum of the   series  







"""Write a program to print sum of the   series       
x-x**2/2!+x^3/3!-x^4/4!..............+x^N/N!
 

N=3
1+1/2!+1/3!=1+0.5+0.16=1.65

"""
X=int(input("Enter a value of X:"))
N=int(input("Enter a value of N:"))
fact=1
sum=0
sign=1

for i in range(1,N+1):
    fact=fact*i  #here we are finding factorial of the number from from 1 to N
    sum=sum+(X**i)*sign/fact
    sign=sign* -1                       # here sign variable used to change the sign in the sum
print("Sum of the series is:",sum)
    
print("Sum of the series is :",sum)
    
     




                                                                                         




Reviewed by Shubham Prajapati on February 09, 2021 Rating: 5

No comments:

If you have any doubt so you can comment me then i will 100% help you ,Through comment Chat

Powered by Blogger.