angelica ostaiza (la peke)
TRANSCRIPT
UNIDAD EDUCATIVA
“HUGO CRUZ ANDRADE”
EJERCICIOS EN GAMBAS
REALIZADOS POR:
OSTAIZA ZAMBRANO ANGELICA PAOLA
“LA PEKE”
ESUDIANTE DEL:
3ERO DE BACHILLERATO “A” SISTEMA
ING:
STALIN RODRIGUEZ
AGRADECIMIENTO
Por medio del presente reitero mis mas sinceros
agradecimientos a mi profesor guía ING. STALIN
RODRIGUEZ, por haber impartido sus sabios conocimientos
en la materia desarrollo de funciones en el sistema informatico
y especialmente en lo que tiene que ver con la codificación y
todo lo referente a Gambas y poder poner en practica la
enseñanza y el aprendizaje, espero realmente todo esto nos
ayude a ser mejores cada dia y a seguir impulsándonos al
mundo del saber.
EJERCICIOS DE CADENA DE TEXTO
(CONSOLA)
1) EJERCICIO QUE MUESTRE EN CONSOLA
UNIDAD EDUCATIVA HUGO CRUZ ANDRADE EL
CARMEN- MANABI- ECUADOR
Public Sub Main ()
Dim Institución as String
Dim Cantón as String
Dim Província as String
Dim País as String
Institución=”UNIDAD EDUCATIVA HUGO CRUZ
ANDRADE”
Cantón=”EL Carmen”
Provincia=”Manabí”
País=”Ecuador”
Print Institución
Print cantón &”_” Provincia & “_” & País
UNIDAD EDUCATIVA HUGO CRUZ ANDRADE
El Carmen – Manabí – Ecuador
2) INGRESAR 3 NOTAS SACAR LA SUMA Y
CALCULAR LA SUMA DEL PROMEDIO
Public Sub Main ()
Dim n1 as Single
Dim n2 as Single
Dim n3 as Single
Dim s as Single
Dim p as Single
Print “Ingrese la Primera Nota”
Input n1
Print “Ingrese la Segunda Nota”
Input n2
Print “Ingrese la Tercer Nota”
Input n3
S= n1+n2+n3
P= s/3
Print “la suma es:”
Print s
Print ”el promedio es:” & p
End
3) CREAR UN PROGRAMA QUE PERMITA LEER LA
CANTIDAD Y EL PRECIO DE UN PRODUCTO, EL MISMO
QUE TIENE UN DESCUENTO DEL 5% MOSTRAR POR
PANTALLA EL PRECIO TOTAL.
Public Sub Main ()
Dim cantidad as Single
Dim precio as Single
Dim subt as Single
Dim des as Single
Dim prt as Single
Dim producto as String
Print “Bienvenidos a mi programa”
Print “ingrese el nombre del producto”
Input producto
Print “ingrese la cantidad del producto”
Input cantidad
Print “ingrese el precio del producto”
Input cantidad
Subt= cantidad*precio
Des=subt*0,05%
Prt=subt-des
Print “el precio total del producto será;”
Print prt
End
4) REALIZAR UN PROGRAMA QUE PERMITA
REALIZAR LA SUMA DE DOS VALORES
Public Sub Main ()
Dim A as Byte
Dim B as Byte
Dim S as Byte
A= “10”
B= “5”
S= A+B
Print “La suma es:”, 5
5) EJERCICIO PARA MOSTRAR LA MULTIPLICACION,
LA DIVISIÓN, LA SUMA Y RESTA DE DOS NÚMEROS.
Public Sub Main ()
Dim S as Integer
Dim P as Integer
Dim O as Integer
Dim A as Integer
S= 10
P=15
O=40
Print S+P
Print O-O
Print S*O
Print P/O
End
6) REALIZAR UN PROGRAMA QUE INGRESE TODAS
LAS OPERACIONES MATEMÁTICAS.
Public Sub Main ()
Dim B as Byte
Dim C as Byte
B=”20”
C=”65”
Print B+C
Print B-C
Print B/C
Print B*C
End
7) EXPORTACIÓN: EL ECUADOR EXPORTA CAFÉ,
CACAO Y MAÍZ EN QUINTALES SE DESEA CALCULAR
EL TOTAL DE EXPORTACIONES Y EL PORCENTAJE DE
CADA PRODUCTO EXPORTANDO, CON LOS
SIGUIENTES DATOS MAÍZ 300, CAFÉ 400, CACAO 800.
Public Sub Main ()
Dim C as Integer
Dim CA as Integer
Dim M as Integer
Dim P1 as Single
Dim P2 as Single
Dim P3 as Single
Dim T as Integer
C= 800
CA= 400
M= 300
T= C+CA+M
P1= (C/T)*100
P1= (CA/T)*100
P1= (M/T)*100
Print “el total de las exportaciones es:”&T
Print “el porcentaje del cacao es:”&P1&”%”
Print “el porcentaje del café es:”&P2&”%”
Print “el porcentaje del maíz es:”&P3&”%”
End
8) REALIZAR UN PROGRAMA QUE CALCULE EL IVA DE
UN PRODUCTO POR PANTALLA SE DEBE MOSTRAR
EL IVA.
Public Sub Main ()
Dim Iva as Single
Dim S as Single
Print “ingrese el valor”
Input Iva
S=Iva*12/100
Print “el Iva es:”S
End
9) REALICE UN PROGRAMA QUE CALCULE EL ÁREA
DE UN TRIÁNGULO TENIENDO COMO DATOS DE
ENTRADA LA BASE Y LA ALTURA.
Public Sub Main ()
Dim b as Single
Dim a as Single
Dim Área as Single
Print “Este programa es para calcular el área, la base y la
altura de un triángulo”;
Print “Ingrese la base del triángulo que desea calcular su
área”;
Input b
“Print “Ingrese la altura del triángulo que desea calcular su
área”;
Input a
Área= (b*a)/2
Print “El área del triángulo es este”;
Print Área
End
10) REALICE UN PROGRAMA QUE PERMITA RECIBIR
COMO DATO DE ENTRADA UNA DISTANCIA MEDIDA
EN METROS Y LA CONVIERTA A KILÓMETROS.
Public Sub Main ()
Dim metro as Single
Dim kilometro as Single
Print “Ingrese la medida en metro”;
Input metro
Km=metro/100
Print “La medida ingresada en metros convertida en
kilómetros es “;
Print “El valor en metros convertida en km es:”&km
End
11) RESOLVER LA SIGUIENTE ECUACIÓN Y=X3-X2+2-3
Public Sub Main ()
Dim x as Integer
Dim e as Integer
X=3
y=x^3-x^2+2-3
Print “El Resultado de la ecuación es”;
Print y
3^3-3^2+2-3
End
12) CREAR UN PROGRAMA QUE CALCULAR EL
SALARIO SEMANAL DE UN EMPLEADO AL QUE SE LE
PAGA $5 POR HORA Y TRABAJA 8 HORAS DIARIAS DE
LUNES A VIERNES.
Public Sub Main ()
Dim Salario as Single
Dim Horas as Single
Dim Total as Single
Salario=5
Horas=8
Total=Salario*Hora*5
Print”El salario semanal del empleado es:”
Print total
End
13) EN UN SALÓN DE CLASE EXISTEN 42 ALUMNOS LA
CUAL QUE ESTÁN DIVIDIDOS EN 30 MUJERES Y 12
VARONES, SE NECESITAN SABER CUÁL ES EL MAYOR
PORCENTAJE DE AMBOS.
Public Sub Main ()
Dim Mujeres as Integer
Dim Varones as Integer
Dim Suma as Integer
Dim por1 as Integer
Dim por2 as Integer
Mujeres=30
Varones=12
Suma=Mujeres +Varones
Por1=Mujeres/Suma*100
Por2=Hombre/Suma*100
Print”El porcentaje de Mujeres y Varones en el salón:”
Print ”Mujeres:”&por1&”%”
Print”Hombres:”&por2&”%”
End
14) CREAR UN PROGRAMA QUE PERMITA LEER LA
CANTIDAD Y EL PRECIO DE UN PRODUCTO , EL MISMO
QUE TIENE UN DESCUENTO DEL 5% MOSTRAR POR
PANTALLA EL PRECIO TOTAL.
Public Sub Main ()
Dim cantidad as Single
Dim precio as Single
Dim Subt as Single
Dim Desc as Single
Dim Prt as Single
Dim producto as Single
Print “Bienvenidos a mi programa”
Print “Ingrese el nombre del producto”;
Input producto
Print “Ingrese la cantidad del producto”;
Input cantidad
Print “Ingrese el precio del producto”;
Input precio
Subt=cantidad*precio
Desc=Subt*0,05%
Prt=Subt-Desc
Print “El precio total del producto será”;
Print Prt
End
15) APLICAR UN SELECT CASE PARA DETERMINAR EL
DESCUENTO QUE SE OTORGA EN LAS PRÓXIMAS
COMPRAS A UN CLIENTE HABITUAL. DICHO CLIENTE
CUENTA CON TARJETA DE CRÉDITO DE LA TIENDA
RETAIR Y EL DESCUENTO ESTÁ RELACIONADO AL
MONTO DE SU FACTURACIÓN DEL MES DE ENERO:
SE CONSIDERA CUATRO NIVELES DE FACTURACIÓN
MONTO FACTURADO DESC. PROXIMA COMPRA <450 40% <150 Y < = 450 30% <150 Y < = 300 20%
< 150 10%
Public Sub Main ()
Dim Monto as Integer
Dim Descuento as Integer
…
Select Case Monto
Case 0+0 to 150
Descuento=10
Case 151 to 300
Descuento=20
Case 301 to 450
Descuento=30
Case >450
Descuento=40
Case Else
Print “Error”
End Select
Print “El descuento otorgado es &descuento&”%”
End
16) INGRESE 3 VALORES E INDIQUE CUAL ES EL
MAYOR.
A B C 15 10 5
Public Sub Main ()
Dim A as Integer
Dim B as Integer
Dim C as Integer
…
Print “Ingrese el valor de A”;
Input 15
Print “Ingrese el valor de B”;
Input 5
Print “Ingrese el valor de C”;
Input 10
If A>B AND A>C
Print “Mayor es A”
Else
If B>A AND B>C
Print “Mayor es B”
Else
If C>A AND C>B
Print “Mayor es C”
Else
Print “Error”
End If
End
17) INGRESE TRES VALORES Y MUESTRE SI ES
POSITIVO, NEGATIVO O NEUTRO.
Public Sub Main ()
Dim Valor as Integer
Print “Ingresa el primer valor”;
Input Valor
If Valor >0 Then
Print “El valor es positivo”
Else
If Valor <0 Then
Print “El valor es negativo”
Else
If Valor ==0 Then
Print “El valor es neutro”
Else
Print “Error”
End If
End
18) FORMA DE PAGO: 1 2 3
Si es 1 el descuento será 10% del valor.
Si es 2 será 15%.Si es 3 no habrá descuento.
Public Sub Main ()
Dim valor as Single
Dim Fp as Integer
Dim D as Single
Print “Ingrese el valor de producto”;
Input valor
Print “Ingrese la forma de pago”;
Input Fp
If Fp==1 then
D=(valor*10)/100
Prinf “El descuento es”&D”%”
Else
Print “No hay descuento”
End If
End
19) SELECT CASE
9 – 10 7 – 8,99 4,01 - 6,99 < = 4
dar aar Paar naar
Public Sub Main ()
Dim Notas as Single
Print “Ingrese las notas”
Input Notas
Select Case Notas
Case < =4
Print “NAAR”
CASE 4,01 to 6,99
Print “PAAR”
Case 7 to 8,99
Print “AAR”
Case 9 to 10
Print “Error”
End Select
20) REALIZA UN PROGRAMA UTILIZANDO LA
SETENCIA FOR PARA MOSTRAR 10 VECES LA
PALABRA AMISTAD.
Public Sub Button1_ click ()
Dim x as Integer
X=1
For x=1 to 10
Listbox 1.add (“Amistad”)
Next
End
21) REALIZAR UNA APLICACIÓN QUE IMPRIMA LOS
MULTIPLOS DE 3 HASTA 99.
Public Sub Button_ click ()
Dim N as Integer
N=0
For N=0 to 99 step3
Listbox1.add (N)
Next
End
22) CALCULADORA PERSONAL
CODIGO FUENTE PUBLIC SUB _new() END PUBLIC SUB Form Open() END PUBLIC SUB Button1_Click() END PUBLIC SUB btnsalir_Click() ME.close END PUBLIC SUB btnlimpiar_Click() txtpArival.text = " " txtsegval.text = " "
txtresul.text = " " END
PUBLIC SUB btnsuma_Click() txtresul.text = txtprival.text + txtsegval.text END PUBLIC SUB btnresta_Click() txtresul.text = txtprival.text - txtsegval.text END PUBLIC SUB btnmulti_Click() txtresul.text = txtprival.text * txtsegval.text END PUBLIC SUB btndivi_Click() txtresul.text = txtprival.text / txtsegval.text END
23) Ejercicio de Edad
Public sub main () Dim edad as integer Edad =txtedad.text If edad<2 and edad>0 then Txtresul.text =”bebe” Else If edad<12 then Txtresul.text =”niño” Else If edad<18 then Txtresul.text =”joven” Else Txtresul.text =”adulto” Endif Endif Endif
24) EJERCICIO DE NÚMERO PAR O IMPAR
Public sub main () Dim N as integer Dim A as integer Print “ingrese un número” Input N N=A mod 2 If=N =A then Print “es par” Else Print “es impar” Endif
TRABAJO REALIZADO POR LA PEKE