0% found this document useful (0 votes)
66 views

Blogs Programas

The document contains several C++ programs that perform basic mathematical and logical operations like: 1. Requesting a number from the user until it is less than 100 2. Drawing shapes like trees, houses and squares using basic loops and print statements 3. Simulating an ATM with options like deposit, withdraw, check balance etc. 4. Finding the maximum, minimum and multiples of numbers from a set of inputs 5. Checking if a number is prime or not The programs demonstrate basic programming concepts like loops, conditional statements, functions and input/output operations.

Uploaded by

Santiago Alvarez
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
66 views

Blogs Programas

The document contains several C++ programs that perform basic mathematical and logical operations like: 1. Requesting a number from the user until it is less than 100 2. Drawing shapes like trees, houses and squares using basic loops and print statements 3. Simulating an ATM with options like deposit, withdraw, check balance etc. 4. Finding the maximum, minimum and multiples of numbers from a set of inputs 5. Checking if a number is prime or not The programs demonstrate basic programming concepts like loops, conditional statements, functions and input/output operations.

Uploaded by

Santiago Alvarez
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 64

1.

INGRESAR UN NMERO HASTA QUE SEA MENOR DE 100


#include <stdio.h>
#include <conio.h>
#include <iostream.h>
#include <math.h>
void main ()
{
int h = 0;
do
{
cout<<"INGRESE UN NUMERO : ";
cin>> h;
}
while(h <= 100);
getch();
cout<<"Dar enter para finalizar";
getch();
}+

2) PRESENTACION DE UN ARBOL
#include <stdio.h>
#include <conio.h>
#include <iostream.h>
void main ()
{
int F=10, C= 40 , CO= 40,f = 26 , c = 35, ci=45;
int v=10, b= 41 , d= 41, a= 26 , u= 36, j=44;
int vi=10, bi= 42 , di= 42, ai= 26 , ui= 37, ji=43;
gotoxy(20,6);cout<<" PRESENTACION DE ARBOL NAVIDENO";
for(int i= 1; i<=15 ; i++)
{
gotoxy(C,F);cout<<"*";
gotoxy(CO,F);cout<<"*";
gotoxy(c,f);cout<<"*";
gotoxy(ci,f);cout<<"*";
f++;
F++;
CO++;
C--;
gotoxy(b,v);cout<<"*";
gotoxy(d,v);cout<<"*";
gotoxy(u,a);cout<<"*";
gotoxy(j,a);cout<<"*";
a++;
v++;
d++;
b--;
gotoxy(bi,vi);cout<<"*";
gotoxy(di,vi);cout<<"*";
gotoxy(ui,ai);cout<<"*";

gotoxy(ji,ai);cout<<"*";
ai++;
vi++;
di++;
bi--;
}
for(int CC= 25; CC<= 55; CC=CC+2)
{
gotoxy(CC,F);cout<<"*" ;
}
for(int Cl= 25; Cl<= 55; Cl=Cl+2)
{
gotoxy(Cl,f);cout<<"*" ;
}
getch();
}

3. CAJERO AUTOMTICO
4. #include <stdio.h>
5. #include <conio.h>
6. #include <iostream.h>
7. #include <math.h>
8. void main ()
9. {
10.int I= 0, C= 0 ;
11.float res= 0, de = 0, sun =0, re=0 ;
12.do
13.{
14.gotoxy(9,4);cout<<" 1 SALDO INICIAL";
15.gotoxy(9,5);cout<<" 2 DEPOSITO ";
16.gotoxy(9,6);cout<<" 3 RETIRO ";
17.gotoxy(9,7);cout<<" 4 CONSULTA DE SALDO ";
18.gotoxy(9,8);cout<<" 5 SALIR ";
19.gotoxy(9,9);cout<<"INGRESE UNA DE LAS OPCIONES DEL SIGUIENTE MENU ";
20.gotoxy(9,10);cin>>I;
21.if(I==1)
22.{
23.gotoxy(9,13);cout<<"DIJITE EL SALDO INICIAL : ";cin>> C;
24.gotoxy(9,13);cout<<" ";
25.}
26.if (I==2)
27.{
28.gotoxy(9,13);cout<<"CUANTO DESEA DEPOSITAR : " ;cin>> de;
29.gotoxy(9,13);cout<<" ";
30.sun = de + sun;
31.}
32.if(I==3)

33.{
34.gotoxy(9,13);cout<<"DIJITE LA CANTIDA QUE DESEA RETIRAR : ";cin>>re;
35.gotoxy(9,13);cout<<" ";
36.if(re < sun)
37.{res = sun - re;}
38.else
39.{ gotoxy(9,13);cout<<"EL SALDO ES INSUFICIENTE ";
40.gotoxy(9,13);cout<<" ";}
41.}
42.if(I== 4)
43.{gotoxy(9,13);cout<<"TOTAL DE SALDO ES: " << C + de - re;}
44.}
45.while(I!=5);
46.gotoxy(9,13);cout<<" ";
47.gotoxy(9,13);cout<<"SE CERRARA EL PROGRAMA DE UN ENTER...............";
48.getch();}

4._PROGRAMA DEL RANGO


#include <stdio.h>
#include <conio.h>
#include <iostream.h>
#include <math.h>
void main ()
{int I= 0, C= 0;
cout<<"INGRESE NUMERO DE RANGO : ";
cin>> I;
cout<<"INGRESE NUMERO DE RANGO : ";
cin>> C;
if( I < C)
{ for( int h= I ; h <= C; h++)
{ cout<<"\n Rango: " << h;} }
else
{ for( int h= C ; h <= I; h++)
{cout<<"\n Rango: " << h;} }
_getch();

5. ELABORACION DE UNA CASA.


#include <stdio.h>
#include <conio.h>
#include <iostream.h>
void main ()
{
int F=25, C=18 , CO= 52 , FI=25,Ci=34,Cu=36, Fi=10;
int f=35,fI=35,ci=31,c=41;
int fg=30,fw=28, fp=27,fk=27,cy=29, cyi= 21,yc=41,yci= 49,fo= 27, fy= 30;
gotoxy(20,6);cout<<"PROGRAMA PRESENTACION DE UNA CASA";
for(int i= 0; i<=15 ; i++)
{
gotoxy(C,F);cout<<"*";
gotoxy(CO,F);cout<<"*";
gotoxy(Ci,Fi);cout<<"*";
gotoxy(Cu,Fi);cout<<"*";
F++;
Fi++;
Cu++;
Ci--;
}
for(int CC= 18; CC<= 52; CC=CC+2)
{
gotoxy(CC,F);cout<<"*";
gotoxy(CC,FI);cout<<"*";
}
for(int i= 1; i<=6 ; i++)
{
gotoxy(c,f);cout<<"*";
gotoxy(ci,f);cout<<"*";
f++;
}

6. MAYORES MENORES Y MULTIPLO DE CINCO.


#include <stdio.h>
#include <conio.h>
#include <iostream.h>
#include <math.h>
void main ()
{
int num ,mayor = 0 , menor = 1000 , multi = 0 ;
gotoxy(19,3);cout<<"INSTITUTO TECNOLOGICO SUPERIOR HUAQUILLAS";
gotoxy(27,4);cout<<" PROGRAMACION COMERCIAL";
gotoxy(18,5);cout<<" NOMBRE: SANTIAGO APOLO";
gotoxy(10,6);cout<<"PROGRAMA INGRESE 10 NUMEROS Y ENCONTRAR TOTAL DE MULTIPLOS DE 5
";
gotoxy(19,7);cout<<"PRESENTAR EL NUMERO MAYOR Y EL MENOR ";
for(int i = 1 ; i<= 10 ; i++)
{
gotoxy(3,10);cout<<" INGRESE UN NUMERO : " ;
gotoxy(6,12);cout<<" " ;
gotoxy(6,12);cin>> num;
if(num % 5 == 0)
multi = multi + 1;
if(num > mayor)
mayor = num;
if(num < menor)
menor = num;
}
gotoxy(8,15);cout<<"\1 El numero mayor es " << mayor;
gotoxy(8,16);cout<<"\2 El numero menor es " << menor;
gotoxy(8,17);cout<<"\3 Total de multiplos de cinco son : " << multi;
getch();
}

7. PRESENTACION DE CUADRADO
#include <stdio.h>
#include <conio.h>
#include <iostream.h>
void main ()
{
int F=10, C= 30 , CO= 50 , FI= 10;
gotoxy(19,3);cout<<"INSTITUTO TECNOLOGICO SUPERIOR HUAQUILLAS";
gotoxy(20,6);cout<<"PROGRAMA PRESENTACION DE CUADRADO";
for(int i= 1; i<=9 ; i++)
{
gotoxy(C,F);cout<<"*";
gotoxy(CO,F);cout<<"*";
F++;
}

8. PRESENTACION DE UN TRIANGULO.
#include <stdio.h>
#include <conio.h>
#include <iostream.h>
void main ()
{int F=10, C= 13 , CO= 63 , FI= 10;
gotoxy(20,6);cout<<PROGRAMA PRESENTACION DE RECTANGULO;
for(int i= 1; i<=9 ; i++)
{gotoxy(C,F);cout<<"*";
gotoxy(CO,F);cout<<"*";
F++;}
for(int CC= 13; CC<= 63; CC=CC+2)
{gotoxy(CC,F);cout<<"*";
gotoxy(CC,FI);cout<<"*";}
getch();}

9._ PRESENTACION DE UN TRIANGULO.


#include <stdio.h>
#include <conio.h>
#include <iostream.h>
void main ()
{
int F=5, C= 20 , CO=20 , FI= 13;
for(int i= 1; i<=9 ; i++)
{gotoxy(C,F);cout<<"*";
gotoxy(CO,F);cout<<"*";
F++;C--;CO++;}
for(int CC= 12; CC<=29; CC=CC+2)
{gotoxy(CC,FI);cout<<"*";}
getch();
}

10. MAYOR DE CINCO NUMEROS.


#include <stdio.h>
#include <conio.h>
#include <iostream.h>
void main()
{
int num ,c = 0 ;
gotoxy(10,6);cout<<" Programa que permita encontrar cual es el mayor de 5 numeros";
for(int i= 1; i<=5 ; i++)
{gotoxy(19,10);cout<<" ";
gotoxy(19,9);cout<<"Ingrese un numero ";
gotoxy(19,10);cin>> num;
if(num > c)
{ c = num;}
gotoxy(20,12);cout<<EL MAYOR ES:<<C;

11. IF ANIDADOS EL MAYOR DE 5 NUMEROS.


#include <stdio.h>
#include <conio.h>
#include <iostream.h>
void main()
{
int n1 , n2 , n3 ,n4 ,n5 ;
gotoxy(19,6);cout<<" Programa que permita encontrar cual es el mayor de 5 numeros";
gotoxy(10,7);cout<<" Evaluacion del primer credito ";
gotoxy(5,8);cout<<"Ingrese cinco numeros: " ;
gotoxy(5,9);cin>> n1;
gotoxy(5,10);cin>> n2;
gotoxy(5,11);cin>> n3;
gotoxy(5,12);cin>> n4;
gotoxy(5,13);cin>> n5;
if(n1 >n2 )
{
if(n1 > n3)
{if(n1 > n4)
{
if(n1 > n5)
{gotoxy(24,20),cout<<"El numero mayor es: " << n1 ;}
else
{cout<<"El mayor es: " << n5;}
}

else
{ if(n4 > n5)
{ cout<<"el mayor es : " << n4;}
else
{cout<<"el mayor es : " << n5;}
}
}else
{
if( n3 > n4 )
{
if (n3 > n5)
{cout<<"el mayor es : " << n3;}
else
{cout<<" el mayor es: " << n5;}
}
else
{
if(n4 > n5)
{ cout<<" el mayor es:" << n4;}
else
{cout<<"el mayor es:" << n5;
}
}
}
}
else
{
if(n2 > n3)
{
if(n2 > n4)
{

if(n2 > n5)


{cout<<" el mayor es:" << n2;}
else
{cout<<" el mayor es: " <<n5; }
}
else
{
if( n4 > n5)
{cout<<"el mayor es :" << n4; }
else
{cout<<" el mayor es: " << n5 ; }
}
} else
{
if(n3 > n4)
{
if(n3 > n5)
{ cout<<"el mayor es : " << n3; }
else
{cout<<"el mayor es: " << n5; }
}else
{
if(n4 > n5)
{cout<< "mayor es : " << n4; }
else
{cout<<" mayor es : " << n5 ; }
}
}
}
getch();}

12. MULTIPLOS DE 5-4-6.


#include <stdio.h>
#include <conio.h>
#include <iostream.h>
#include <math.h>
void main ()
{int num ;
gotoxy(10,6);cout<<"PROGRAMA INGRESE 10 NUMEROS Y ENCONTRAR MULTIPL DE 5 , 4, 6";
for(int i = 1 ; i<= 10 ; i++)

{
gotoxy(3,10);cout<<" INGRESE UN NUMERO : " ;
gotoxy(6,12);cout<<" " ;
gotoxy(6,12);cin>> num;
if(num % 5 == 0)
{gotoxy(13,15);cout<<"El numero : " << num << " es multiplo de cinco";}

else
{gotoxy(13,18);cout<<"El numero : " << num << " No es multiplo de cinco ";}
if(num % 4 == 0)
{gotoxy(13,16);cout<<"El numero : " << num << " es multiplo de cuatro";}
else
{gotoxy(13,19);cout<<"El numero : " << num << " No es multiplo de cuatro ";}
if(num % 6 == 0){gotoxy(13,17);cout<<"El numero : " << num << " es multiplo de seis";}
else{gotoxy(13,20);cout<<"El numero : " << num << " No es multiplo de seis ";} }
getch();}

13. INGRESE 5
NUMEROS
DETERMINAR
CUAL ES PRIMO
Y CUAL NO LO
ES.
#include
<stdio.h>
#include
<conio.h>
#include
<iostream.h>
#include
<math.h>
void main ()
{
int num ;
gotoxy(19,3);cout<<"INSTITUTO TECNOLOGICO SUPERIOR HUAQUILLAS";
gotoxy(27,4);cout<<" PROGRAMACION COMERCIAL";
gotoxy(18,5);cout<<" NOMBRE: HILDA RAMIREZ MORENO";

gotoxy(10,6);cout<<" INGRESE 5 NUMEROS Y ENCONTRAR CUALES SON PRIMOS ";


for(int i = 0 ; i<= 4 ; i++)
{
gotoxy(3,10);cout<<" INGRESE UN NUMERO : " ;
gotoxy(6,12);cout<<" " ;
gotoxy(6,12);cin>> num;
for(int j=1; j <= num;j++)
{
if(num % 2 == 0)
{gotoxy(8,15);cout<<"\1 El numero " << num <<" no es primo";}
else
{ gotoxy(8,15);cout<<"\1 El numero " << num <<" si es primo";} }
}
getch();

15. INGRESO DE NMERO MIENTRAS SEA DIFERENTE QUE CERO Y PRESENTE EL MAYOR.
#include <stdio.h>
#include <conio.h>
#include <iostream.h>
#include <math.h>
void main ()
{int h = 0, ma = 0 ;
do
{cout<<"INGRESE UN NUMERO : ";

cin>> h;
if( h > ma)
{ma = h;} }
while(h != 0);
clrscr();
cout<<"El numero mayor de los numeros ingresados es : " << ma;
getch();

16. SUMA DE DOS NUMEROS.


#include <stdio.h>
#include <conio.h>
#include <iostream.h>
#include <math.h>
void main ()
{
int num ,num1,j=1, suma = 0,tot = 0;
gotoxy(10,6);cout<<" INGRESE 2 NUMEROS PRESENTAR LA SUMA DE LOS MISMOS";
for(int i = 1 ; i<=1 ; i++)
{ j++;
gotoxy(3,10);cout<<" INGRESE UN NUMERO N " << i <<": ";gotoxy(29,10);cout<<" "
;gotoxy(29,10);cin>> num1;
gotoxy(3,11);cout<<" INGRESE UN NUMERO N " << j <<": ";gotoxy(29,11);cout<<" "
;gotoxy(29,11);cin>> num;
suma = num1 + num;}
gotoxy(8,14);cout<<" La suma es: " << suma;
getch();
}

17. INGRESE DOS NUMEROS DETERMINAR EL MAYOR DE ELLOS.


#include <stdio.h>
#include <conio.h>

#include <iostream.h>
void main()
{
int n1 = 0, n2= 0 ;
gotoxy(12,14);cout<<"****************************";
gotoxy(12,16);cout<<"****************************";
gotoxy(12,1);cout<<"************************************************************";
gotoxy(12,5);cout<<"************************************************************";
gotoxy(12,2);cout<<"*"; gotoxy(71,2);cout<<"*";
gotoxy(12,3);cout<<"*"; gotoxy(71,3);cout<<"*";
gotoxy(12,4);cout<<"*"; gotoxy(71,4);cout<<"*";
gotoxy(14,3);cout<<"DETERMINE CUAL DE LOS DOS NUMEROS INGRESADOS ES EL MAYOR ";
gotoxy(7,10);cout<<"\1 Ingrese primer numero : "; cin>> n1;
gotoxy(7,11);cout<<"\3 Ingrese segundo numero: "; cin>> n2;
if(n1 > n2 )
{gotoxy(13,15);cout<<"El numero mayor es: \5 " << n1; }
else
{gotoxy(13,15);cout<<"El numero mayor es: \5 " << n2;}
_getch();
}

18. INGRESO DE TRES NUMEROS DETERMINO EL MAYOR.


#include <stdio.h>
#include <conio.h>
#include <iostream.h>
void main()
{
int n1, n2 ,n3;
gotoxy(23,17);cout<<"****************************";
gotoxy(23,18);cout<<"*"; gotoxy(50,18);cout<<"*";
gotoxy(23,19);cout<<"*"; gotoxy(50,19);cout<<"*";
gotoxy(23,20);cout<<"****************************";
gotoxy(10,1);cout<<"******************************************************************";
gotoxy(10,5);cout<<"******************************************************************";
gotoxy(10,2);cout<<"*"; gotoxy(75,2);cout<<"*";
gotoxy(10,3);cout<<"*"; gotoxy(75,3);cout<<"*";
gotoxy(10,4);cout<<"*"; gotoxy(75,4);cout<<"*";
gotoxy(12,3);cout<<"DETERMINE CUAL DE LOS TRES NUMEROS INGRESADOS ES MAYOR Y MENOR
";
gotoxy(13,10);cout<<"\1 Ingrese primer numero : "; cin>> n1;
gotoxy(13,11);cout<<"\3 Ingrese segundo numero: "; cin>> n2;
gotoxy(13,12);cout<<"\5 Ingrese tercer numero: "; cin>> n3;
if((n1 > n2) && (n1 > n3))
{ gotoxy(25,18);cout<<"El numero mayor es: \5 " << n1; }
else
{

if((n2 > n1 )&& (n2 > n3))


{gotoxy(25,18);cout<<"El numero mayor es: \5 " << n2;}
else
{gotoxy(25,18);cout<<"El numero mayor es: \5 " << n3; }
}

if((n1 < n2 ) && (n1 < n3))


{gotoxy(25,19);cout<<"El numero menor es: \5 " << n1;}
else
{
if((n2 < n1 ) && (n2 < n3))
{gotoxy(25,19);cout<<"El numero menor es: \5 " << n2; }
else
{gotoxy(25,19);cout<<"El numero menor es: \5 " << n3;}
}
_getch();
}

19. SUMA DE DOS NUMEROS.


#include<stdio.h>
#include<conio.h>
#include<iostream.h>
void main ()
{ int n1 = 0 , n2 = 0;
gotoxy(1,4);cout<<" Ingrese primer numero : " ;
cin>> n1 ;
gotoxy(2,5);cout<<"Ingrese primer numero : " ;
cin >> n2 ;
gotoxy(7,6); cout<<"****************************************";
gotoxy(7,11);cout<<"***************************************";
gotoxy(7,7); cout<<"*"; gotoxy(46,7); cout<<"*";
gotoxy(7,8); cout<<"*"; gotoxy(46,8); cout<<"*";
gotoxy(7,9); cout<<"*"; gotoxy(46,9); cout<<"*";
gotoxy(7,10);cout<<"*"; gotoxy(46,10); cout<<"*";
gotoxy(7,11);cout<<"*"; gotoxy(46,11); cout<<"*";
gotoxy(10,7);cout<<"\1 SUMA " << n1 <<" + " << n2 << " = " << (n1 + n2 ) ;
gotoxy(10,8);cout<<"\2 RESTA " << n1 <<"- " << n2 <<" = " << (n1 - n2 );
gotoxy(10,9);cout<<"\3 MULTIPLICAION " << n1 <<" * " << n2 <<" = " << (n1 * n2);
gotoxy(10,10);cout<<"\4DIVICION " << n1 <<" / " << n2 <<" = " <<( n1 % n2 );
_getch();
}

20. VECTORES. DE 5 NUMEROS INGRESADOS DETERMINE EL MAYOR.


#include <iostream>
#include <conio>
int main()
{
float vector1[5];
int mayor = 0, f = 7;
int i;
gotoxy(10,5);cout << " vector : ";
for ( i=0; i<5; i++)
{gotoxy(10,f);cin >> vector1[i];
f++;
}mayor = vector1[0];
for ( i=0; i<5; i++)
{
if(vector1[i] > mayor )
{mayor = vector1[i]; }
}
gotoxy(10,15);cout << "EL MAYOR DE LOS VECTORES ES: " << mayor ;
getch ();
}

21. INGRESE TRES VECTORES DE 5 NUMEROS CADA UNO


#include <iostream>
#include <conio>
int main()
{float vector1[5],mayor=0,vector3[5],vector2[5] ;
int i, f=7,mayor1=0 , mayor2=0;
for ( i=0; i<5; i++)
{gotoxy(10,5),cout << "VECTOR A : ";
gotoxy(10,f),cin >> vector1[i];
f++;
if(vector1[i] > mayor )
{mayor = vector1[i]; }}
f=7;
for ( i=0; i<5; i++)
{gotoxy(25,5),cout << "VECTOR B ";
gotoxy(25,f),cin >> vector2[i];
f++;
if(vector2[i] > mayor1)
{mayor1 = vector2[i]; }}
f=7;
for ( i=0; i<5; i++)
{gotoxy(40,5),cout << "VECTOR 3 ";
gotoxy(40,f),cin >> vector3[i];
f++;
if(vector3[i] > mayor2 )
{mayor2 = vector3[i]; }}
gotoxy(10,15);cout << "EL MAYOR VECTOR1 : " << mayor << "\n ";
gotoxy(10,18);cout << "EL MAYOR VECTOR2 : " << mayor1<< "\n ";
gotoxy(10,20);cout << "EL MAYOR VECTOR3 : " << mayor2 << "\n ";
getch ();
}

22. UN VECTOR DE 5 ELEMENTOS DETERMINE CUAL EL MAYOR EL MENOR Y PROMEDIO.


#include <iostream>
#include <conio>
int main()
{
float vector1[5];
int mayor=0, f = 7, promedio=0 , suma= 0, menor=100;
int i,c=0;
gotoxy(10,5);cout << " vector : ";
for ( i=0; i<5; i++)
{gotoxy(10,f);cin >> vector1[i];
f++;
c++;
suma= vector1[i]+ suma;
promedio= suma/c;
}
for ( i=0; i<5; i++)
{
if(vector1[i] > mayor )
{mayor = vector1[i]; }
}

for ( i=0; i<5; i++)


{
if(vector1[i] < menor )
{ menor = vector1[i]; }
}
gotoxy(10,15);cout << "EL MAYOR DE LOS VECTORES ES: " << mayor ;
gotoxy(10,16);cout << "EL MENOR DE LOS VECTORES ES: " << menor ;
gotoxy(10,17);cout << "EL PROMEDIO DE LOS VECTORES ES: " << promedio ;
getch ();
}

23. FACTORIAL DE CINCO NUMEROS.


#include <stdio.h>
#include <conio.h>
#include <iostream.h>
void main ()
{
int v1[4], vr[4];
int r=1,f=11,n;
gotoxy(17,6);cout<<"PROGRAMA DE FACTORIAL DE UN VECTOR PRESENTAR EN OTRO VECTOR";
gotoxy(10,10);cout<<" VA";
gotoxy(30,10);cout<<"RESULTADO FACTORIAL";
for(int i=0;i<4; i++)
{
gotoxy(13,f);cin>>v1[i];
for(n=1;n<=v1[i];n++)
{ r=r*n; } vr[i]=r;
f++;r=1;}
f=11;
for(int i=0;i<4;i++)
{gotoxy(35,f); cout<<vr[i]; f++;}
getch();
}

24. PROGRAMA DE UN CAJERO CON LA UTILOZACION DE SEGN SEA.


#include <conio.h>
#include <iostream.h>
#include <stdlib.h>
void main ()
{ system("color D0");
float ganancia=0;
int op=0,retiro=0,saldo_inicial=100,nuevo_saldo=1;
do
{
cout<<"\tBIENVENIDO A SU CAJERO DEL BANCO DEL PICHINCHA ";
cout<<"\n\nQUE TRANSACCIN DESEA REALIZAR? ";
cout<<"\n1. RETIRO DE EFECTIVO ";
cout<<"\n2. CONSULTA DE SALDO ";
cout<<"\n3. GANANCIA POR RETIRO ";
cout<<"\n4. SALIR ";
cout<<"\n ELIJA UNA OPCION-----> ";
cin>>op;
switch(op)
{
case 1:
cout<<"\n\n RETIRO DE EFECTIVO ";
cout<<"\n\n INGRESE LA CANTIDAD QUE DESEA RETIRAR ";
cin>>retiro;
if(retiro<=100)
{
if(retiro<=saldo_inicial)
{
saldo_inicial=saldo_inicial-retiro;
nuevo_saldo=nuevo_saldo+1;
cout<<"\nSU SALDO DISPONIBLE ES ----> "<<saldo_inicial;

}
else
{
cout<<"\nNO DISPONE DE ESA CANTIDAD DE DINERO ";
}
} break;
case 2:
cout<<"\CONSULTA DE SALDO ";
cout<<"\n\nSU SALDO DISPONIBLE ES ---> "<<saldo_inicial;
break;
case 3:
ganancia=nuevo_saldo*0.35;
cout<<"\nGANANCIA POR TRANSACCIONES "<<ganancia;
break;
case 4:
cout<<"\nGRACIAS POR UTILIZAR NUESTROS SERVICIOS ";
cout<<"\n\nES UN GUSTO SERVIRLE ";
break;
default: cout<<"\nOPCION INCORRECTA " ;
} getch();
system ("cls");
}while(saldo_inicial!=0);
getch();
}

25. CREAR 2 VECTORES (V) DE 3 ELEMENTOS Y UN TERCER VECTOR QUE CONTENGA EL


RESULTADO DE V"B" ELEVADO AL CUBO + V"A" FACTORIAL - 2
#include <conio.h>
#include <stdio.h>
#include <iostream.h>
//CREAR 2 VECTORES (V) DE 3 ELEMENTOS Y UN TERCER VECTOR QUE CONTENGA EL RESULTADO
//DE V"B" ELEVADO AL CUBO + V"A" FACTORIAL - 2
void main()
{
int v1[3],v2[3],v3[3],r=1,n,num,f=10,fff=15,ff=16, ii=1, iii=1;
gotoxy(5,2); cout<<"INSTITUTO TECNOLOGICO SUPERIOR HUAQUILLAS";
gotoxy(5,3); cout<<"HILDA RAMIREZ MORENO ";
gotoxy(5,8); cout<<" Ingrese 3 numeros:";
gotoxy(48,8); cout<<"Factorial:";
for(int i=0;i<=2; i++)
{ gotoxy(13,f);cin>>num;
for(n=1;n<=num;n++)

{ r=r*n; }
v1[i]=r;
gotoxy(51,f);cout<<v1[i];
r=1;f++;ii++;
}gotoxy(5,14); cout<<" Ingrese 3 numeros mas:";
gotoxy(46,14); cout<<"Elevado al cubo:";
for(int i=0;i<=2; i++)
{ gotoxy(13,ff); cin>>n;
v2[i]= n*n*n;
gotoxy(51,ff);cout<<v2[i];
ff++;
}
clrscr();
gotoxy(17,10);cout<<"TABLA DE RESULTADOS.";

gotoxy(10,12);cout<<"VECTOR#1";gotoxy(10,13); cout<<"Factorial";
gotoxy(32,12);cout<<"VECTOR#2";gotoxy(29,13); cout<<"Elevado al cubo";
gotoxy(53,12);cout<<"VECTOR#3";gotoxy(50,13); cout<<"Fac + cub - 2 =";
for(int i=0;i<=2; i++)
{v3[i]= v1[i]+v2[i]-2;
gotoxy(13,fff);cout<<v1[i];
gotoxy(36,fff);cout<<v2[i];
gotoxy(56,fff);cout<<v3[i];
fff++;
}getch ();
}

26. CREAR UN VECTOR DE 10 ELEMENTOS, PRESENTE UN SEGUNDO VECTOR QUE


CONTENGA EL RESULTADO AL CUADRADO DEL PRIMER VECTOR Y PRESENTE EN UN
TERSER VECTOR EL RESULTADO AL CUADRADO DEL SEGUNDO VECTOR.
#include <conio.h>
#include <stdio.h>
#include <iostream.h>
void main()
{
int v1[5],v2[5],v3[5],f=10,ff=10,ii=1;
gotoxy(5,2); cout<<"INSTITUTO TECNOLOGICO SUPERIOR HUAQUILLAS";
gotoxy(5,8); cout<<" LLENE EL VECTOR #1";
gotoxy(30,8); cout<<" VECTOR #2";
gotoxy(51,8); cout<<" VECTOR #3";
for(int i=0;i<=4; i++)
{ gotoxy(13,f); cin>>v1[i];
v2[i]=v1[i]*v1[i];
v3[i]=v2[i]*v2[i];
f++;
}
for(int i=0;i<=4; i++)
{ gotoxy(35,ff);cout<<v2[i];
gotoxy(55,ff);cout<<v3[i];
ff++;
}getch ();
}

27._SUMA DE DOS VECTORES.


#include <iostream.h>
#include <conio.h>
#include <stdlib.h>
#include <stdio.h>
int main()
{float vector1[4],vector2[4], vector3[4];
int i,j ;
for ( i=0; i<4; i++)
{ cout << "\nIntrodusca elemento primer vector : ";
cin >> vector1[i];
}clrscr();
for ( i=0; i<4; i++)
{cout << "\nIntrodusca elemento segundo vector : ";
cin >> vector2[i]; vector3[i]= vector1[i] + vector2[i];
}
clrscr();
for (j=0; j<4; j++)
{cout << "\nLa suma de los dos vectores es : " << vector3[j] << "\n ";
}
getch ();
}

28._FUNCIONES ENCONTRAR EL MAYOR , MENOR Y PROMEDIO


#include <iostream.h>
#include <conio.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
//Encuentro el mayor, menor y promedio
float fun_mayor( float v[])
{ float may=0;
for (int i=0;i<5;i++)
{
if (v[i]>may)
{ may=v[i]; }
}return may;
}
float fun_menor(float v[])
{float men=100;
for (int i=0;i<5;i++)
{if (v[i]<men)
{ men= v[i];}} return men;
}
float fun_prome(float v[])
{float suma=0 ,pro=0;
for (int i=0;i<5;i++)

{suma=suma + v[i];}
pro= suma/ 5;
return pro;
}
//ingrese 10 elementos en un vector y presentar el mayor ,menor y el promedio de la mismas.
float main()
{float v[5];int f= 5;
cout<<"\n\n INGRESE ELEMENTOS AL VECTOR ";
for (int i=0;i<5;i++)
{gotoxy(5,f);cin>>v[i];f++;};
cout<<"\n\n La mayor es : "<<fun_mayor(v);
cout<<"\n\n La menor es : "<<fun_menor(v);
cout<<"\n\n El promedio es :"<<fun_prome(v);
getch();
}

29._FUNCION PRESENTE CUANTOS ADULTOS HAY CUANTOS MENORES Y CUANTOS


MAYORES.
#include <iostream.h>
#include <conio.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int fun_Adultos(int ed[])
{int suma=0;
for(int x=0;x<5; x++)
{
if(ed[x] > 64)
{suma =suma +1;}}
return suma;
}
int fun_mayor(int ed[])
{int sun=0;
for(int h=0;h<5; h++)
{if((ed[h] >17)&&(ed[h] <65))
{ sun=sun+1;}
}return sun;
}
int fun_menores(int ed[])
{int sum=0;
for(int j=0;j<5; j++)
{if(ed[j] < 18)
{sum=sum+1;}}
return sum;

}
int main()
{ int ed[5],f=4;

cout<<"\n INGRESE EDADES: ";


for(int i=0;i<5; i++)
{ gotoxy(5,f);cin>>ed[i];f++;}
cout<<"\n\n ADULTOS " << fun_Adultos(ed);
cout<<"\n\n MAYORES " << fun_mayor(ed);
cout<<"\n\n MENORES " << fun_menores(ed);
getch();
}

30._FUNCION INGRESE EN UN VECTOR Y CUENTE CUANTOS PRIMOS HAY.


#include <conio.h>
#include <iostream.h>
#include <stdio.h>
#include <math.h>
int funcion_pri( int v1[])
{
int p=0;
for( int x=0; x<10; x++)
{ if(v1[x]%2==0)
{
p=p+1;
}
}
return p;
}
int main()
{
int v1[10],f=15;
gotoxy(5,8); cout<<" INGRESE 10 ELEMENTOS EN UN VECTOR Y PRESENTAR NUMEROS PRIMOS";
gotoxy(10,12); cout<<"V1";
for( int x=0; x<10; x++)
{
gotoxy(10,f);cin>> v1[x];
f++;
}
gotoxy(25,15);cout<<"TOTAL DE NUMEROS PRIMOS:.."<<funcion_pri(v1);
getch();
}

31. FUNCION DE UNA SERIE DE NUMEROS PRESENTAR EL MAYOR.


#include <conio.h>
#include <iostream.h>
#include <stdio.h>
#include <math.h>
int funcion_serie( int vil)
{
cout << "\n INGRESE NUMERO ";
int may=0, f=5;
do
{gotoxy(10,f);cin >> vil;f++;
if (vil >may)
{
may= vil;
}
} while( vil !=0);
return may;
}
int main()
{
int vil=0;
cout << " REPETIRA MIENTRAS SEA DIFERENTE DE CERO(0) \n ";
cout << " \n EL NUMERO MAYOR ES "<< funcion_serie(vil);
getch ();
}

32. CALCULAR LOS NUMERO DENTRO DE UN RANGO


#include <conio.h>
#include <iostream.h>
#include <stdio.h>
#include <math.h>
int funcion_rango( int nv ,int nnv)
{
int f=10;
for ( int i=nv; i<=nnv; i++)
{gotoxy(15,f);cout<<"Rango: "<< i; f++; }
}
int main()
{
cout<< "\n CALCULAR LOS NUMEROS ENTRE UN RANGO \n ";
int nv=0, nnv=0;
cout<< "\n ingrese el numero inicial ";cin>> nv;
cout<< "\n ingrese el numero final ";cin>> nnv;
funcion_rango(nv,nnv);
getch ();
} 32. CALCULAR LOS NUMERO DENTRO DE UN RANGO
#include <conio.h>
#include <iostream.h>
#include <stdio.h>
#include <math.h>
int funcion_rango( int nv ,int nnv)
{
int f=10;
for ( int i=nv; i<=nnv; i++)
{gotoxy(15,f);cout<<"Rango: "<< i; f++; }
}
int main()
{
cout<< "\n CALCULAR LOS NUMEROS ENTRE UN RANGO \n ";
int nv=0, nnv=0;
cout<< "\n ingrese el numero inicial ";cin>> nv;
cout<< "\n ingrese el numero final ";cin>> nnv;
funcion_rango(nv,nnv);
getch ();
}

33._ INGRESE 5 ELEMENTOS EN UN VECTOR Y PRESENTAR EL NUMERO MAYOR.


#include <conio.h>
#include <iostream.h>
#include <stdio.h>
#include <math.h>
int funcion_may( int v1[])
{
int may=0;
for( int x=0; x<4; x++)
{
if(v1[x]> may)
{may = v1[x];
}
}
return may;
} int funcion_may2( int v2[])
{
int may2=0;
for( int x=0; x<4; x++)
{
if(v2[x]> may2)
{may2 = v2[x];}
}
return may2;
}
int funcion_may3( int v3[])
{
int may3=0;
for( int x=0; x<4; x++)
{

if(v3[x]> may3)
{may3 = v3[x];}
} return may3;
}
int main()
{ int v1[4],v2[4],v3[4],f=15;
gotoxy(5,8); cout<<" INGRESE 5 ELEMENTOS EN UN VECTOR Y PRESENTAR EL NUMERO MAYOR";
gotoxy(10,12); cout<<"V1";
gotoxy(20,12); cout<<"V2";
gotoxy(30,12); cout<<"V3";
for( int x=0; x<4; x++)
{gotoxy(10,f);cin>> v1[x];
f++;
} f=15;
for( int x=0; x<4; x++)
{gotoxy(20,f);cin>> v2[x];
f++;} f=15;
for( int x=0; x<4; x++)
{gotoxy(30,f);cin>> v3[x];f++;}
gotoxy(40,15);cout<<"MAYOR V1 ES:"<<funcion_may(v1);
gotoxy(40,16);cout<<"MAYOR V2 ES:"<<funcion_may2(v2);
gotoxy(40,17);cout<<"MAYOR V3 ES:"<<funcion_may3(v3);
getch();
}

34. CONTAR CUANTOS SON MULTIPLOS DE CINCO CUATRO Y TRES.


#include <stdio.h>
#include <conio.h>
#include <iostream.h>
#include <math.h>
int multip(int num[])
{
int cin=0;
for(int i = 1; i<6 ; i++)
{
if(num[i] % 5 == 0)
{
cin=cin+1;
}

}
return cin;
}
int multio(int num[])
{
int cua=0;
for(int P = 1; P<6 ; P++)
{
if(num[P] % 4 == 0)
{
cua=cua+1;
}
}
return cua;
}
int multii(int num[])

{
int sei=0;
for(int J= 1;J<6; J++)
{
if(num[J] % 6 == 0)
{
sei = sei +1;
}
}
return sei;
}
int main()
{
int num[5],f=12 ;
gotoxy(10,6);cout<<"PROGRAMA INGRESE 5 NUMEROS Y ENCONTRAR MULTIPLOS DE 5 , 4, 6";
for(int i = 1 ; i<6; i++)
{
gotoxy(3,10);cout<<" INGRESE UN NUMERO : " ;
gotoxy(6,f);cin>>num[i];
f++;
}
gotoxy(20,16);cout<<"TOTAL MULTIPLO DE CINCO :"<<multip(num);
gotoxy(20,17);cout<<"TOTAL MULTIPLO DE SEIS :"<<multii(num);
gotoxy(20,18);cout<<"TOTLA MULTIPLO DE CUATRO :"<<multio(num);
getch();
}

35. FUNCIONES PROGRAMA INGRESE 5 NUMEROS Y ENCONTRAR TOTAL DE MULTIPLOS


DE 5
#include <stdio.h>
#include <conio.h>
#include <iostream.h>
#include <math.h>
int fun_men(int num[])
{
int menor = 10000;
for(int p=1; p<5; p++)
{
if(num[p] < menor)
{menor = num[p];}
}return menor;
}
int fun_mut(int num[])
{
int multi = 0;
float div;
for(int h=1;h<5; h++)
{

div = (num[h] %5);


if(div== 0)
{multi = multi + 1; }
}
return multi;
}
int fun_may(int num[])
{
int mayor = 0;
for(int l=1; l<5; l++)
{

if(num[l] > mayor)


{mayor = num[l];}
} return mayor;
}
int main()
{ int num[5],f=12;
gotoxy(10,6);cout<<"PROGRAMA INGRESE 5 NUMEROS Y ENCONTRAR TOTAL DE MULTIPLDE 5 ";
gotoxy(19,7);cout<<"PRESENTAR EL NUMERO MAYOR Y EL MENOR ";
for(int i = 1 ; i< 5 ; i++)
{gotoxy(3,10);cout<<" INGRESE UN NUMERO : " ;
gotoxy(6,f);cin>> num[i];
f++;
}
gotoxy(10,15);cout<<"\1 El numero mayor es " <<fun_may(num);
gotoxy(10,16);cout<<"\2 El numero menor es " <<fun_men(num);
gotoxy(10,17);cout<<"\3 Total de multiplos de cinco son : " <<fun_mut(num);
getch();
}

36. INGRESAR DOS NUMEROS Y LE PRESENTE LA SUMA, RESTA, MULTIPLICACION Y


DIVISION DE LOS MISMOS
#include <iostream.h>
#include <conio.h>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
//ingresar dos nmeros y le presente la suma, resta, multiplicacion y divicion de los mismos
float fun_suma(float a , float b)// se guardara el valor de x como a= x
{
float c;
c= a+b;
return c;
}
float fun_res(float a , float b)// se guardara el valor de x como a= x
{
float c;
c= a - b;
return c;
}
float fun_mut(float a , float b)// se guardara el valor de x como a= x
{
float c;
c= a * b;
return c;

}
float fun_divi(float a , float b)// se guardara el valor de x como a= x
{
float c;
c= a/b;
return c;

}
void menu()
{
cout<<"\n\t OPERACIONES MATEMATICAS C++\n\n";
cout<<" \7 \1. INGRESO ELEMENTO "<<endl;
cout<<" \7 \2. SUMA "<<endl;
cout<<" \7 \3. RESTA "<<endl;
cout<<" \7 \4. MULTIPLICACION "<<endl;
cout<<" \7 \5. DIVICION "<<endl;
cout<<" \7 \6. SALIR "<<endl;
cout<<"\n INGRESE OPCION: ";
}
int main()
{
int op;
float x ,y ;
system("color F0");
do
{
menu();
cin>> op;
switch(op)
{
case 1:
system ("cls");
cout<<"\n\t INGRESE UN NUMERO: "; cin>> x ;
cout<<"\n\t INGRESE UN NUMERO: "; cin>> y ;
break;
case 2:
system ("cls");
cout<<"\n\n LA SUMA DE : "<< x <<" + " << y << " = " << fun_suma(x ,y);

break;
case 3:
system ("cls");
cout<<"\n\n LA RESTA DE : "<< x <<" - " << y << " = " << fun_res(x ,y);
break;
case 4:
system ("cls");
cout<<"\n\n LA MULTIPLICACION DE : "<< x <<" * " << y << " = " << fun_mut(x ,y);
break;
case 5:
system ("cls");
cout<<"\n\n LA DIVICION DE : " << x <<" / " << y << " = " << fun_divi(x ,y);
break;
}
cout<<endl<<endl;
system("pause"); system("cls");
}while(op!=6);
return 0;
}

37. FUNCION DE INGRESO DE 5 ELEMENTOS EN UN VECTOR Y PRESENTAR EL NUMERO


MAYOR
#include <conio.h>
#include <iostream.h>
#include <stdio.h>
#include <math.h>
int funcion_may( int v1[])
{int may=0;
for( int x=0; x<4; x++)
{if(v1[x]> may)
{may = v1[x];}
} return may;
}
int main()
{ int v1[4],f=15;
gotoxy(5,8); cout<<" INGRESE 5 ELEMENTOS EN UN VECTOR Y PRESENTAR EL NUMERO MAYOR";
gotoxy(10,12); cout<<"V1";
for( int x=0; x<4; x++)
{ gotoxy(10,f);cin>> v1[x]; f++; }

gotoxy(20,15);cout<<"MAYOR ES:"<<funcion_may(v1);
getch();
}

38. FACTORIAL EN FUNCIONES


#include <stdio.h>
#include <iostream.h>
#include <conio.h>
/* Factorial de un nmero - versin 1- */
long int factorial(int x) /*definicin de funcin*/
{
int i;
long int fac = 1;
for (i=2; i<=x; i=i+1)
fac=fac*i;
return (fac);
}
main (fac) /* funcin principal */
{
int a,f=5,fi=5;
cout<<" \n\n Introduce el numero \n\n ";
for(int i=1;i<=5;i++)
{
gotoxy(10,f); cin>> a;f++;
if (a>0)
gotoxy(30,fi);cout<<" Factorial : "<< factorial (a);
fi++;
getch();

39. SACAR EL CUBO DE UN NMERO SIN RETORNAR UN VALOR.


#include <iostream.h>
#include <conio.h>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
void funcion_cubo()
{
system("color f0");

float a,b;
cin>>a;
b=pow(a,3); // pow permite para sacar la potencias
cout<<"\n\n\tEL CUBO DEL NUMERO INGRESADO ES : "<<b;
}
int main()
{
system("color f0");
gotoxy(20,3);cout<<" INSTITUTO TECNOLOGICO SUPERIOR HUAQUILLAS ";
gotoxy(15,6);cout<<" INGRESAR UN NUMERO Y PRESENTAR SU CUBO ";
gotoxy(15,9); cout<<" INGRESE UN NUMERO: ";
funcion_cubo();
getch();
}

40. INGRESE 10 ELEMENTOS EN UN VECTOR Y PRESENTAR EL MAYOR, MENOR Y EL


PROMEDIO DE LA MISMAS. (sin retornar valor).
#include <iostream.h>
#include <conio.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
//Encuentro el mayor , menor y promedio
float fun_op()
{float v[5],suma=0,men=1000,pro=0,may=0;
int f= 5;
for (int i=0;i<5;i++)
{ gotoxy(5,f);cin>>v[i];
f++;
if (v[i]>may)
{ may=v[i];}
if (v[i]<men)
{men= v[i];
}suma=suma + v[i];}
pro = suma/5;
cout<<"\n\t La menor es : " <<men;
cout<<"\n\t La mayor es : "<< may;
cout<<"\n\t El promedio es :"<<pro;
}

void main()
{cout<<"\n\n INGRESE ELEMENTOS AL VECTOR ";
fun_op();
getch();
}

You might also like