Class 11 Science Program
Class 11 Science Program
Irogram importmath
equation, ax**2 +bx + c = 0, enter coefficients below")
print ("For quadratic :"))
a= int(input (" Enter a
b :"))
b= int(input (" Enter
C= int(input ("Enter c
:") ) NoTE
Youcan use sqrt( ) function of math package
if a ==0: to calculate squareroot of anumber. Use it as:
print ("Value of", a, 'should not be zero')
math.sqrt (<number or expression> )
print ("\n Aborting !!!!!!")
To use this function, add first line as
else :
import math to your program
delta =b *b -4 *a *c
if delta > 0 :
root1 = (-b+ math.sqrt (delta) ) / (2 * a)
root2 = (-b - math.sqrt (delta) ) / (2 * a)
print ("Roots are REAL and UNEQUAL")
print ("Root1 =", root1, ", Root2 =", root2)
elif delta == 0:
root1 =-b/ (2 * a)
print ("Roots are REAL and EQUAL")
print ("Root1 =", root1, ", Root2 =",
root1) NoTE
else : An if statement is also known as
IMAGINARY") a conditional.
print ("Roots are COMPLEX and
coefficients below
equation, ax**2 + bx + c= 0, enter
ror quadratic
Enter a :3
Enter b: 5
Enter c : 2
Roots are REAL and UNEQUAL
= -1.0
Rootl = -0.666666666667 , Root2
RESTART coefficients below
enter
bX + C= 0,
For quadratic equati on, ax**2 +
Enter a : 2
Enter b: 3
Enter c: 4
IMAGINARY
Roots are COMPLEX and
RESTART coefficients below
enter
ax**2 + bx + c= 0,
For quadratic equation,
Enter a : 2
Enter b: 4
Enter c : 2
Roots are REAL and EQUAL
OYRO0e Go ROot2 = 1
3, 2025, 13:11
Chd
Solution.
(input("Enter value of x: "))
y= int
int(input("Enter the power (n): "))
n=
S=0
Sign = +1
range(n + 1):
for a in * sign
term = (x ** a)
S+= term
Sign*= 1
first", n, "terms :", s)
print("Sum of
value of x: 5
Enter
power (n): 4
Enter the terms: 521
hen first 4
Sum of
and determine if theyform a
KInput three angles W
triangleor not.
Solution.
#check triangle from angles So
=0
angle1 = angle2 = angle3
float(input ("Enter angle 1 : "))
angle1 = angle 2 : "))
angle2 = float (input ("Enter
float(input ("Enter angle 3: "))
angle3 = 180 :
angle2 + angle3) ==
if (angle1 + triangle. ")
print ("Angles form a
else:
not form atriangle.")
print ("Angles do and n