You are on page 1of 23

Fundamentos de programacin

Ingeniera en sistemas
computacionales

Profesor:
Arturo Egua Alvarez

ISC 1C

Integrantes del equipo:


Edgar Martnez Hernndez
Luis Angel Garca Hernndez
Jaime Alan Daz Morales
Problema1
#include <cstdlib>

#include <iostream>

using namespace std;

int main(int argc, char *argv[])

int i, contm, conth;

char genero, respuesta;

contm=0;

conth=0;

for(i=1;i<5;i++) //para el numero de grupos

cout<<"ingenieria industrial grupo " <<i <<endl;

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;

else cout<<"selecciona correctamente tu respuesta" <<endl;

cout<<"hay mas estudiantes en el grupo?....s/n" <<endl;

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>

using namespace std;

int main()

int i,opcion;

float vdia=0,vsemana=0;

char respuesta;

for(i=1;i<6;i++)

cout <<"\n\n\tDia "<<i<<"\n";

do

cout <<"\nDesea comprar s/n ---> ";

cin >>respuesta;

if(respuesta=='s')

cout <<"\n1.- celular $2000.00\n";

cout <<"2.- Television $3000.00\n";

cout <<"3.- Laptop $5000.00\n\n";


cout <<"Elija el articulo a comprar---> ";

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;

cout <<"\nVenta de la semana $"<<vsemana;

return 0;

Problema3
#include <cstdlib>
#include <iostream>

using namespace std;

int hom(int a);


int muj(int b);

int main(int argc, char *argv[])

int i, numero, x = 0 , y = 0,sexo;

cout << "ingrese el numero que hay Ingenieria industrial: ";


cin >> numero;

for(i=1 ; i<=numero ; i++)

cout << "ingrese el numero (2) si es hombre o el numero (3) si es mujer "<< endl;

cin >> sexo;

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>

using namespace std;

/* run this program using the console pauser or add your own getch, system("pause") or input
loop */

int main(int argc, char** argv)

{
int n;

char nulos,negativos,positivos;

while(_n<=100)

if(_n%1==0)

scant("%n"&n)

if(n>0)

cout<<("escribe cuanyos numeros son positivos")<<endl;

else

cout<<("escribe cuantos numeros son nulos")<<endl;

else

ccout<<("escribe cuantos numeros son negativos")<<endl;

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 main(int argc, char** argv)

int n, primos;

char 2<=100;

while(2<=100)
if(2%1==0)

if(n>100)

cout<<"dame numeros primos/n"<<endl;

cin>>resp;

return 0;

PROBLEMA8
#include <iostream>

using namespace std;

int main()

long long int i,po=3;

cout <<"3\n";

for(i=1;i<=25;i++)

po=po*3;

cout <<po<<"\n";

}
return 0;

Problema9

#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 main(int argc, char** argv)

int i, tabla;

char resp;

do{

cout<<"que tabla quieres conocer"<<endl;

cin>>tabla;

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

cout<<tabla<<*<<i<<" = "<<(tabla*i)<<endl;
}

cout<<"quieres conocer otra tabla?.........s/n"<<endl;

cin>>resp;

}while(resp=='s');

system("PAUSE");

return 0;

Problema10

#include <cstdlib>

#include <iostream>

using namespace std;

int main(int argc, char *argv[])

int sueldo_hora = 80; // sueldo por hora

//int conhoraextra = 100; // 80 + 25%

int semana = 7; //D-as de trabajo

double sueldo1 = 0, sueldo2 = 0, ispt = .14;

sueldo1 = semana * sueldo_hora * 8;

sueldo2 = sueldo1 - (ispt * sueldo1);

cout << "Sueldo Neto = " << sueldo1<< endl;

cout << "Sueldo Bruto = " << sueldo2<< endl;


system("PAUSE");

return EXIT_SUCCESS;

PROBLEMA 11
#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 main(int argc, char** argv)

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;

for (b=1 ; b<=a ; b++)

factorial=b*factorial;

cout << "El factorial del numero ingresado es " <<factorial<<endl;


system("pause");

return 0;

PROBLEMA12
#include <cstdlib>

#include <iostream>

#include <stdio.h>

#include <math.h>

using namespace std;

/* run this program using the console pauser or add your own getch, system("pause") or
input loop */

int main(int argc, char** argv)

double sum=0,pot;

int i;

for(i=0;i<=30;i++){

pot=pow(4,i);

printf("4 Potencia %d = %0.1lf \n",i,pot);

sum=sum+pot;

rintf("Suma Total : %0.1lf",sum);

system("PAUSE");
return 0;

PROBLEMA13
#include <cstdlib>

#include <iostream>

using namespace std;

int main(int argc, char *argv[])

int a = 0;

int stop = 20;

for (int i = 0; i < stop ; i++)

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>

using namespace std;

/* run this program using the console pauser or add your own getch, system("pause") or
input loop */

int main(int argc, char** argv)

//Definicion de variables

int _cont;

while(_cont<=1000){//limita el conteo hasta 1000

if(_cont%2==0){//verificar si es par

printf("%d, ",_cont);

}//END verificar si es par

_cont++;//Se incrementa la variable

}//END limita el conteo hasta 1000

getch();

return 0;

PROBLEMA15
#include <cstdlib>

#include <iostream>
using namespace std;

int main(int argc, char *argv[])

int num = 0;

int limit = 100;

cout << "Escribe un numero "<< endl;

do

cin >> num;

} while (num >= limit);

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 main(int argc, char** argv)

int i, tabla;

char resp;

do{

cout<<"deseas continuar?........s/n" <<endl;

cin>>resp;

}while(resp=='s');

system("PAUSE");

return 0;

PROBLEMA17
#include <cstdlib>

#include <iostream>

#include <stdlib.h>

using namespace std;

/* run this program using the console pauser or add your own getch, system("pause") or input
loop */

int main(int argc, char** argv)

int num;

do {

cout<<"Ingrese un numero ";

cin>>num;

} while (num > 1 || num < 5);

system("PAUSE");

return 0;

PROBLEMA 18
#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 main(int argc, char** argv)

float[] num= new float[1000];

float mayor=0, menor=0;

int flag =0;

while (int i = 0; i < 1000; i++)

cout("Ingrese {0} numero:",i+1);

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)

cout("\nLos numros son todos iguales\n");

else

cout("\nEl menor de los numeros es el {0} y el menor es el {1}",menor,mayor);

system("PAUSE");

return 0;

PROBLEMA 19
#include <cstdlib>

#include <iostream>

#include <stdio.h>

#include <con.o.h>

using namespace std;

/* run this program using the console pauser or add your own getch, system("pause") or input
loop */

int main(int argc, char** argv)

int n=0,s=0;

while (n<100)
{n=n+2;

s=s+n;}

cout("La suma de los numeros pares es: %d",s);

getch ( );

system("PAUSE");

return 0;

PROBLEMA20
#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 main(int argc, char** argv)

int numero; //contiene el n que vamos leyendo

bool multiplo=false; //indica si el numero es multiplo de 3

int cuantos = 0; //total de numeros

int multiplosde2=0; //total de multiplos de 2

double sumatoria=0; //almacena la suma de los numeros para despues realizar el promedio
do{

cout<<"Serie de numeros: ";

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<<"Numeros leidos: "<<cuantos<<"\n";

cout<<"Multiplos de 2: "<<multiplosde2<<"\n";

cout<<"Promedio de numeros: "<<sumatoria/cuantos<<"\n\n";

system("pause");

return 0;

You might also like