Search

# 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

## Recent Posts

See All

#### Python program to add one or more element in List

Program: #Append() is used for adding one element in List at the end of list. X=[9,18,27] X.append(36) print(X) output: [9, 18, 27, 36] #Insert () is used for add element at any given position in the

#### Python program to remove elements of a given list

Program: n=[9,18,27,36,45,54,63] print("List=",n) i=int(input("Enter the position of elements to delete : ")) del n[i] print("List after deletion=",n) del n[:2] print("List after deleting first two el

#### Python program to create a list of 5 numbers

Python program to create a list of 5 numbers. Numbers entered by User. n=[] for i in range(5): j=int(input("Enter number: ")) n.append(j) print("The List is", n) Output: Enter number: 3 Enter number: