Respuesta :
You can just look up "python ide online" on google and paste this code:
n = -1
count = 0
while n < 0:
n = int(input("We're checking to see if a number is prime or not! Enter a positive number: "))
if n % 2 == 0:
if n == 2:
print("{} is a prime number".format(n))
else:
print("{} is not a prime number".format(n))
else:
for x in range(n, 1, -1):
if n % x == 0:
count += 1
if count > 1 or n == 1:
print("{} is not a prime number".format(n))
else:
print("{} is a prime number".format(n))
I've written some code that checks to see if a number entered by the user is a prime number or not.
Sorry, but I'm not too good with pseudocode plans and all that. I hope this helps.
Answer:
import math
print("Let's solve ax² + bx + c = 0")
a = int(float(input('Enter a value for a: ')))
b = int(float(input('Enter a value for b: ')))
c = int(float(input('Enter a value for c: ')))
D = b*b-4*a*c
if (D<0):
print("Sorry, this equation has no solutions.")
elif (a == 0):
if (b == 0):
if (c == 0):
print("Every value of x is a solution")
else:
print("Sorry, this equation has no solutions")
else:
x = -c/b
print("The one solution is x={:.3g}".format(x))
elif (D==0):
x = (-b + math.sqrt(D)) / (2*a)
print("The one solution is x={:.3g}".format(x))
else:
x1 = (-b + math.sqrt(D)) / (2*a)
x2 = (-b - math.sqrt(D)) / (2*a)
print("This equation has two solutions: x={:.3g} or x={:.3g}".format(x1, x2))
Explanation:
Above is another little program to use the quadratic formula.