Está en la página 1de 4

/*Realice un programa que visualice todos los numeros pares en orden descendente

menores que 20*/



#include<stdio.h>
#include<conio.h>
void main()
{
int i=20;
while(i)
{
if (i%2==0)
printf("\n%d es par",i);
i--;
}
getch();
}

/* DESARROLLE UN PROGRAMA QUE LEA DOS NUMEROS A Y B. LUEGO IMPRIMA TODOS LOS
NUMEROS ENTRE A Y B INCLUIDOS POR EJEMPLO, SI INGRESAN 5 Y 15 SE IMPRIMIRA
5,6,7, HASTA EL 15.*/

#include <stdio.h>
#include <conio.h>
void main()
{
int nA,nB, nu;
printf("\n Ingrese el primer numero");
scanf("%d",&nA);
printf("\n Ingrese el segundo numero");
scanf("%d",&nB);
while (nA<=nB)
{
nu=nA+0;
printf("\n %d",nu);
nA++;
}
getch();
}

COMPRAS
#include <stdio.h>
#include <conio.h>
void main()
{
int salir,saliryesno;
salir=0;
while(salir==0){
clrscr();
int opt,uni,total;
printf("\t\t ELIJA EL PRODUCTO DESEADO:\n\n");
printf("\t\t PRODUCTO \t\t\t CODIGO \n\n");
printf("\t\t CAMISA...............................1\n");
printf("\t\t CINTURON.............................2\n");
printf("\t\t ZAPATOS..............................3\n");
printf("\t\t PANTALON.............................4\n");
printf("\t\t CALCETINES...........................5\n");
printf("\t\t FALDAS...............................6\n");
printf("\t\t GORRAS...............................7\n");
printf("\t\t SUETER...............................8\n");
printf("\t\t CORBATA..............................9\n");
printf("\t\t CHAQUETA............................10\n");
printf("\t\t INTRODUZCA EL CODIGO: ");
scanf("%d",&opt,"\n");
while ((opt<1)||(opt>10))
{

printf("CODIGO INCORRECTO. INTRODUZCA NUEVO CODIGO :");
scanf("%d",&opt,"\r");
}

printf("\n");
switch(opt){
case 1:
printf("\t\EL PRECIO ES: $20.00\n");
printf("\t\t INTRODUZCA EL NUMERO DE UNIDADES: ");
scanf("%d",&uni);
total=20*uni;
printf("\n\t\t EL TOTAL A PAGAR ES $%d.00\n\n", total);
break;
case 2:
printf("\t\EL PRECIO ES: $15.00\n");
printf("\t\t INTRODUZCA EL NUMERO DE UNIDADES: ");
scanf("%d",&uni);
total=15*uni;
printf("\n\t\t EL TOTAL A PAGAR ES $%d.00\n\n", total);
break;
case 3:
printf("\t\EL PRECIO ES: $60.00\n");
printf("\t\t INTRODUZCA EL NUMERO DE UNIDADES: ");
scanf("%d",&uni);
total=60*uni;
printf("\n\t\t EL TOTAL A PAGAR ES $%d.00\n\n", total);
break;
case 4:
printf("\t\EL PRECIO ES: $30.00\n");
printf("\t\t INTRODUZCA EL NUMERO DE UNIDADES: ");
scanf("%d",&uni);
total=30*uni;
printf("\n\t\t EL TOTAL A PAGAR ES $%d.00\n\n", total);
break;
case 5:
printf("\t\EL PRECIO ES: $7.00\n");
printf("\t\t INTRODUZCA EL NUMERO DE UNIDADES: ");
scanf("%d",&uni);
total=7*uni;
printf("\n\t\t EL TOTAL A PAGAR ES $%d.00\n\n", total);
break;
case 6:
printf("\t\EL PRECIO ES: $25.00\n");
printf("\t\t INTRODUZCA EL NUMERO DE UNIDADES: ");
scanf("%d",&uni);
total=25*uni;
printf("\n\t\t EL TOTAL A PAGAR ES $%d.00\n\n", total);
break;
case 7:
printf("\t\EL PRECIO ES: $12.00\n");
printf("\t\t INTRODUZCA EL NUMERO DE UNIDADES: ");
scanf("%d",&uni);
total=12*uni;
printf("\n\t\t EL TOTAL A PAGAR ES $%d.00\n\n", total);
break;
case 8:
printf("\t\EL PRECIO ES: $35.00\n");
printf("\t\t INTRODUZCA EL NUMERO DE UNIDADES: ");
scanf("%d",&uni);
total=35*uni;
printf("\n\t\t EL TOTAL A PAGAR ES $%d.00\n\n", total);
break;
case 9:
printf("\t\EL PRECIO ES: $22.00\n");
printf("\t\t INTRODUZCA EL NUMERO DE UNIDADES: ");
scanf("%d",&uni);
total=22*uni;
printf("\n\t\t EL TOTAL A PAGAR ES $%d.00\n\n", total);
break;
case 10:
printf("\t\EL PRECIO ES: $90.00\n");
printf("\t\t INTRODUZCA EL NUMERO DE UNIDADES: ");
scanf("%d",&uni);
total=90*uni;
printf("\n\t\t EL TOTAL A PAGAR ES $%d.00\n\n", total);
break;
}
printf("SI DESEA SALIR PRESIONE 1 O DE LO CONTRARIO PRESIONE OTRO NUMERO: ");
scanf("%d",&saliryesno);
switch(saliryesno){
case 1:
salir=1;
}
}
getch();
}




/*DETERMINAR CUANTOS ESTUDIANTES DE UN GRUPO DE 40 PASAN
EL 1.5 MTS DE ESTATURA.
INGRESE LA ESTATURA INDIVIDUAL DE CADA ESTUDIANTE*/
/* determinar cuntos estudiantes d eun grupo de 40 pasam el 1.5 metros de
estatura, ingrese la estatura individual de cada estud.*/

#include<stdio.h>
#include<conio.h>
void main()
{
int c=1,c2=0;
float est;
while(c<=5)
{
printf("\n Ingrese la Estatura %d:",c);
scanf("%f",&est);
c++;
if(est>1.5)
c2=c2+1;
}
printf("\n Estudiantes de estatutura mayor a 1.5 metros son:%d",c2);
getch ();
}

/*CODIFIQUE UN PROGRAMA QUE INGRESE 5 NOTAS DE 5 ESTUDIANTES LUEGO
PRESENTE EL PROMEDIO DE LAS NOTAS INGRESADAS*/

#include <stdio.h>
#include <conio.h>
void main()
{
float i=1,j=0,n1,n2,n3,n4,ex,pro;
while (i<=5)
{
printf("Ingrese la cantidad de estudiantes:");
scanf("%f", &i);
pro=(n1+n2+n3+n4+ex)/5;
j=j+1;
}
printf("el promedio de las notas es:%.2f",pro);
getch();
}

También podría gustarte