algoritmos, diagramas de flujo y programas · pdf filealgoritmos, diagramas de flujo y...
TRANSCRIPT
ALGORITMOS,
DIAGRAMAS DE FLUJO Y PROGRAMAS DE SMALL
BASIC EJERCICIOS 1-10
MARLON ADALBERTO URRUTIA DUARTE 5TO PAE. “B”
1) Muestre en pantalla el mensaje “bienvenido”.
1. Inicio
2. Mostrar bienvenido
3. Fin
Textwindow.writeline (“bienvenido”)
Inicio
Mostrar
“bienvenido”
Fin
2) Mostrar en pantalla el mensaje “small basic no tiene misterios”
1. Inicio
2. Mostrar mensaje “small basic no tiene misterios”
3. Fin
Textwindow.writeline (“small basic no tiene misterios”)
Inicio
Mostrar
mensaje
“small bacis
no tiene
misterios”
fin
3) Muestre en pantalla la suma de 100 y 120
1. Inicio
2. a = 100, b= 120, s = 0
3. s = a+b
4. mostrar en pantalla s
5. fin
a = 100
b = 120
s = a+b
textwindow.writeline (“la suma total es” + s )
incio
a = 100, b = 120,
s= 0
s = a+b
Mostrar s
fin
4) muestre en pantalla el producto de 50 y 51
1. inicio
2. a = 50, b = 5, p = 0
3. p = a * b
4. mostrar en pantalla p
5. fin
a = 50
b = 51
p = a*b
textwindow.writeline (“el producto es” + p)
inicio
a = 50, b = 51,
p = 0
P = a*b
Visualizar p
fin
5) Guarde en la variable x el numero 23, en la variable y el numero 24 y en
la variable z el numero 25 y muestre en pantalla la suma de los valores
de las tres variables
1. Inicio
2. x = 23, y = 24, z = 25, s = 0
3. s = x+y+z
4. mostrar en pantalla s
5. fin
x = 23
Y = 24
Z = 25
s = x + y + z
textwindow.writeline (“el total de la suma es” + s)
inicio
x = 23, y = 24, z = 25,
s = 0
s = x + y + z
Visualizar s
fin
6) Guarde en la variable x el numero 10 en la variable y el numero 11 y en
la variable z el numero 12 y calcule su producto y guárdelo en la
variable producto y muestre en pantalla el valor de la variable.
1. Inicio
2. x = 10, y = 11. Z = 12, producto = 0
3. producto = x*y*z
4. visualizar producto
5. fin
x = 10
y = 11
z = 12
producto = x*y*z
textwindow.writeline (“el producto total es” + producto)
Inicio
x = 10, y = 11,
z = 12, producto = 0
Producto = x*y*z
Visualizar
producto
Fin
7) Pida al usuario dos numero ( que se guardaran en las variables a y b) y
muestre su suma
1. Inicio
2. a = 0, b = 0, s = 0
3. Ingresar primer numero
4. Ingresar segundo numero
5. S = a + b
6. Visualizar s
7. Fin
Textwindow.writeline (“ingresar primer numero”)
a = Textwindow. Read ()
texwindow.writelin (“ubgresar segundo numero”)
b = textwindow.read ()
s = a + b
texwindow.writeline (“la suma total es” + s)
inicio
a = 0, b = 0, s= 0
Ingrese primer
numero
Ingrese segundo
numero
s = a+b
Visualizar s
fin
8) Pida al usuario dos números ( que se guardaran en las variables n1 y
n2) y muestre en pantalla su producto.
1. Inicio
2. N1= 0, n2 = 0, p = 0
3. Ingrese primer numero
4. Ingrese segundo numero
5. P = n1 * n2 6. Visualizar p
7. Fin
Textwindow.writeline (“ingrese primer numero”)
N1= textwindow.read ()
Textwindow.writeline (“ingrese segundo numero”) N2= textwindow.read ()
P = N1* N2
Textwindow.writeline (“el producto total es” + p)
inicio
N1 = 0, n2= 0,
p= 0
Ingrese primer
numero
Ingrese segundo
numero
P = n1*n2
Visualizar p
fin
9) Pida al usuario dos números enteros (que se guardaran en la variables
dato 1 y dato2) y muestre en pantalla el resultado de dividir dato 1 y
dato 2.
1. Inicio
2. Dato 1 = 0, dato2= 0, div = 0
3. Ingrese primer numero
4. Ingrese segundo numero
5. Div = dato1/dato2
6. Visualizar div
7. Fin
Textwindow.writeline (“ingrese un numero”)
Dato 1 = textwindow.read ()
Textwindow.writeline (“ingrese otro numero”)
Dato 2 = textwindow.read ()
Div = dato 1 / dato 2
Textwindow.writeline (“el total de la división es “ + div)
inicio
Dato 1 = 0, dato 2 = 0
div = 0
Ingrese primer
número
Ingrese segundo
número
div = dato 1 / dato 2
Visualizar div
fin
10) Pida al usuario dos números reales que se guardaran en las
variables dato 1 y dato 2 si dato 2 es cero, deberá mostrar mensaje de
error, caso contrario mostrara el resultado de dividir dato 1 y dato 2.
1. Inicio
2. DATO 1= 0,DATO 2= 0, div = 0
3. ingrese un numero
4. ingrese segundo numero
5. div = dato 1 / dato 2
6. si dato 2 = 0
7. visualizar mensaje de error (“ingrese un numero que no sea 0”)
8. regresar paso 4
9. de lo contrario
10.visualizar div
11.fin del si
12.fin
TextWindow.WriteLine("Ingrese primer número")
dato1=TextWindow.Read() Regresar:
TextWindow.WriteLine("Ingrese segundo número")
dato2=textwindow.Read() If dato2=0 Then
TextWindow.WriteLine("INGRESE NUMERO QUE NO SEA CERO")
Goto Regresar: EndIf
DIV=dato1/dato2
TextWindow.WriteLine("LA DIVISION TOTAL ES: "+t)