Pythons Library Math Functions Programs


Write a program to input the value of x and calculate the result of the following equation:

ex +cos x+ √ X

Program:

import math

x=float(input("Enter the value for x:"))

a=math.exp(x)

b=math.cos(x*(3.14/180))

c=math.sqrt(x)

d=a+b+c

print("The result of this Equaction=",d)

Output:

Enter the value for x:12

The result of this Equaction= 162759.2336902897



Write a program to input the values of x and y. Calculate and print result of the following equation:

Log√ x/y

Program:

import math

x=float(input("Enter the value for x: "))

y=float(input("Enter the value for y: "))

z=x/y

a=math.sqrt(z)

b=math.log(a)

print("The result of given equation is ", b)


Output:

Enter the value for x:20

Enter the value for y:5


The result of given equation is 0.6931471805599453


Write a program to print three sides of a triangle. Calculate and print its area using Heron's Formula.

Program:

import math

x=float(input(" Enter one side of triangle :"))

y=float(input(" Enter Second side of triangle :"))

z=float(input(" Enter third side of triangle :"))

s=(x+y+z)/3

A=math.sqrt(s*(s-x)*(s-y)*(s-z))

print("The Area of triangle is ", A)

Output:

Enter one side of triangle :7

Enter Second side of triangle :5

Enter third side of triangle :2

The Area of triangle is 3.11111111111111

3 views0 comments

Recent Posts

See All
 

9555593818

Thakurdwara, Uttar Pradesh 244601, India

  • Facebook
  • Twitter
  • LinkedIn