-
Lenguaje
Python
-
Descripción
Dados N valores, haga el siguiente proceso:
- Si el valor es menor que cero calcular su cubo.
- Si el valor está entre 0 y 100 calcular su cuadrado.
- Si el valor está entre 101 y 1000 calcular su raíz cuadrada.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import os, math
n = int (input ('Ingresa el valor de n: '))
for i in range (1, n + 1):
print ('PROCESO ' + repr (i))
v = float (input ('Ingresa el valor de v: '))
resultado=0
if v<0:
resultado=v*v*v
if v>=0 and v<=100:
resultado=v*v
if v>=101 and v<=1000:
resultado=math.sqrt(v)
print ('Valor de resultado: ' + repr (resultado))
print ()
n = int (input ('Ingresa el valor de n: '))
for i in range (1, n + 1):
print ('PROCESO ' + repr (i))
v = float (input ('Ingresa el valor de v: '))
resultado=0
if v<0:
resultado=v*v*v
if v>=0 and v<=100:
resultado=v*v
if v>=101 and v<=1000:
resultado=math.sqrt(v)
print ('Valor de resultado: ' + repr (resultado))
print ()