0% found this document useful (0 votes)
5 views2 pages

CE-721 Hidroinformática Quiz Solutions

The document contains the code for 3 questions. Question 1 involves calculating the total overpayment for textbooks based on inputted actual and paid costs and number of books. Question 2 calculates a loan payment amount given inputs for loan amount, number of years, and interest rate. Question 3 determines if a inputted number is prime by counting its factors.

Uploaded by

ELI
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views2 pages

CE-721 Hidroinformática Quiz Solutions

The document contains the code for 3 questions. Question 1 involves calculating the total overpayment for textbooks based on inputted actual and paid costs and number of books. Question 2 calculates a loan payment amount given inputs for loan amount, number of years, and interest rate. Question 3 determines if a inputted number is prime by counting its factors.

Uploaded by

ELI
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

CE-721 Hidroinformática

Quizz 01

Nombres: ELI PABLO OSORIO POLINAR

PREGUNTA 01

a=int(input("How much do you want to pay for each textbook?:"))


b=int(input("How much did the average textbook actually cost?:"))
c=int(input("How many books did you buy?:"))
diferencia=b-a
porcentaje=int((b-a)/a*100)
pago_total=porcentaje*c
print("Each book is overpriced by" ,"$",diferencia,"\t", porcentaje,"%")
print ("you got ripped off by","$",pago_total )

PREGUNTA 02

loan=int(input("Loan amount?:"))
n_year=int(input("Number of years?:"))
int_anual=float(input("Interest rate?:"))
c=int_anual/12/100
n=n_year*12
payment=int(loan*(c*((1+c)**n))/(((1+c)**n)-1))
print("your payment is","$",payment)
PREGUNATA 03

x=int(input("What is your favorite number?:"))


n=0
for i in range(1,x+1):
if x%i==0:
n=n+1
if n==2:
print (x,"has",n,"factors")
print(x, "is prime")
else :
print (x,"has",n,"factors")
print(x,"is not prime")

You might also like