Professional Documents
Culture Documents
Ingeniera en sistemas
computacionales
Profesor:
Arturo Egua Alvarez
ISC 1C
#include <iostream>
contm=0;
conth=0;
do{
cout<<"que genero eres?...h/m..."<<endl;
cin>>genero;
if(genero=='m') //mujer
contm=contm+1;
else
if(genero=='h') //hombre
conth=conth+1;
cin>>respuesta;
while(respuesta=='s');
cout<<"total de hombres" <<conth <<"y mujeres" <<contm <<"en el grupo " <<i;
system("PAUSE");
return EXIT_SUCCESS;
}
Problema2
#include <iostream>
int main()
int i,opcion;
float vdia=0,vsemana=0;
char respuesta;
for(i=1;i<6;i++)
do
cin >>respuesta;
if(respuesta=='s')
cin >>opcion;
switch(opcion)
case 1:
vdia=vdia+2000;
break;
case 2:
vdia=vdia+3000;
break;
case 3:
vdia=vdia+5000;
break;
}while(respuesta=='s');
vsemana=vsemana+vdia;
cout <<"\nVenta del dia $"<<vdia<<"\n";
vdia=0;
return 0;
Problema3
#include <cstdlib>
#include <iostream>
cout << "ingrese el numero (2) si es hombre o el numero (3) si es mujer "<< endl;
if(sexo == 2)
x=hom (x);
if(sexo == 3)
y=muj(y);
cout<< "En el grupo hay "<< x <<" hombres y "<< y << " mujeres"<< endl;
system("Pause");
return 0;
int mas(int a)
return(a + 1);
int fem(int b)
return(b + 1);
system("Pause");
return 0;
Problema5
#include <cstdlib>
#include <iostream>
/* run this program using the console pauser or add your own getch, system("pause") or input
loop */
{
int n;
char nulos,negativos,positivos;
while(_n<=100)
if(_n%1==0)
scant("%n"&n)
if(n>0)
else
else
system("PAUSE");
return 0;
Problema7
#include <iostream>
/* run this program using the console pauser or add your own getch, system("pause") or input
loop */
int n, primos;
char 2<=100;
while(2<=100)
if(2%1==0)
if(n>100)
cin>>resp;
return 0;
PROBLEMA8
#include <iostream>
int main()
cout <<"3\n";
for(i=1;i<=25;i++)
po=po*3;
cout <<po<<"\n";
}
return 0;
Problema9
#include <cstdlib>
#include <iostream>
/* run this program using the console pauser or add your own getch, system("pause") or input
loop */
int i, tabla;
char resp;
do{
cin>>tabla;
for(i=0;i<=10;i++)
cout<<tabla<<*<<i<<" = "<<(tabla*i)<<endl;
}
cin>>resp;
}while(resp=='s');
system("PAUSE");
return 0;
Problema10
#include <cstdlib>
#include <iostream>
return EXIT_SUCCESS;
PROBLEMA 11
#include <cstdlib>
#include <iostream>
/* run this program using the console pauser or add your own getch, system("pause") or
input loop */
int a,b,factorial;
cout << "Este programa calculara el factorial del numero entero que ingrese \nPor favor
ingrese su numero " <<endl;
cin >> a;
factorial=1;
factorial=b*factorial;
return 0;
PROBLEMA12
#include <cstdlib>
#include <iostream>
#include <stdio.h>
#include <math.h>
/* run this program using the console pauser or add your own getch, system("pause") or
input loop */
double sum=0,pot;
int i;
for(i=0;i<=30;i++){
pot=pow(4,i);
sum=sum+pot;
system("PAUSE");
return 0;
PROBLEMA13
#include <cstdlib>
#include <iostream>
int a = 0;
a = a + i/2;
cout << "La suma de los primeros 20 numeros pares es: " << a <<endl;
system("PAUSE");
return EXIT_SUCCESS;
PROBLEMA14
#include <cstdlib>
#include <iostream>
#include <stdio.h>
#include <conio.h>
/* run this program using the console pauser or add your own getch, system("pause") or
input loop */
//Definicion de variables
int _cont;
if(_cont%2==0){//verificar si es par
printf("%d, ",_cont);
getch();
return 0;
PROBLEMA15
#include <cstdlib>
#include <iostream>
using namespace std;
int num = 0;
do
cout << "Haz tecleado un numero inferior a 100: " << endl << "El numero fue: "<<
num << endl;
system("PAUSE");
return EXIT_SUCCESS;
PROBLEMA16
#include <cstdlib>
#include <iostream>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input
loop */
int i, tabla;
char resp;
do{
cin>>resp;
}while(resp=='s');
system("PAUSE");
return 0;
PROBLEMA17
#include <cstdlib>
#include <iostream>
#include <stdlib.h>
/* run this program using the console pauser or add your own getch, system("pause") or input
loop */
int num;
do {
cin>>num;
system("PAUSE");
return 0;
PROBLEMA 18
#include <cstdlib>
#include <iostream>
cin<<num;
if(flag==0)
mayor=num[i];
menor=num[i];
flag=1;
else
if(num[i]>mayor)
mayor=num[i];
if(num[i]<menor)
menor=num[i];
}
}
if(mayor==menor)
else
system("PAUSE");
return 0;
PROBLEMA 19
#include <cstdlib>
#include <iostream>
#include <stdio.h>
#include <con.o.h>
/* run this program using the console pauser or add your own getch, system("pause") or input
loop */
int n=0,s=0;
while (n<100)
{n=n+2;
s=s+n;}
getch ( );
system("PAUSE");
return 0;
PROBLEMA20
#include <cstdlib>
#include <iostream>
/* run this program using the console pauser or add your own getch, system("pause") or input
loop */
double sumatoria=0; //almacena la suma de los numeros para despues realizar el promedio
do{
cin>>numero;
if(numero%3==0){
multiplo = true;
else if(numero%2==0){
multiplosde2++;
cuantos++;
sumatoria+=numero;
else{
cuantos++;
sumatoria+=numero;
cout<<"\n";
}while(multiplo==false);
cout<<"Multiplos de 2: "<<multiplosde2<<"\n";
system("pause");
return 0;