/*codifique un programa utilizando las sentencia que ingrese el numero del mes
y presente el nombre del mes que corresponde"*/
# include <stdio.h> # include <conio.h> void main () { int op; printf ("ingrese el numero de mes 1-12"); scanf ("%d", op); switch (op) { case 1: printf ("ENERO"); break; case 2: printf ("FEBRERO"); break; case 3: printf ("MARZO"); break; case 4: printf ("ABRIL"); break; case 5: printf ("MAYO"); break; case 6: printf ("JUNIO"); break; case 7: printf ("JULIO"); break; case 8: printf ("AGOSTO"); break; case 9: printf ("SEPTIEMBRE"); break; case 10: printf ("OCTUBRE"); break; case 11: printf ("NOVIEMBRE"); break; case 12: printf ("DICIEMBRE"); break; default: printf (" no existe este mes"); } getch();
NOTAS CON CICLOS
#include <stdio.h> #include <conio.h> void main() { float suma=0, prom, menor=11, mayor=-1, nota; int i=1,j=0; while(i<=14) { printf("ingrese la nota del alumno %d:\n", i); scanf("%f",¬a); while(nota<0.00 || nota >10.00) { printf("ERROR, la nota debe estar entre 0 y 10"); scanf ("%f", ¬a); } if (nota>=7.00) j=j+1; if(nota>mayor) mayor=nota; if(nota<menor) menor=nota; i=i+1; suma=suma+nota; }
/*codificar un programa que ingrese por teclado un numero determinado de alumnos a continuacion ingrese las 3 notas y presenre el promediod e las notas ingresadas */
#include <conio.h> #include <stdio.h> void main() { float not,n1,n2,ex,prom, i=1, j=0; while (i<=6) { printf("ingrese la notas del estudiante,"%d" \n, "&i"); scanf("%f", ¬); while (not)
VENTA DE CAMARON # include <stdio.h> # include <conio.h> void main() { int cod; float pre,tp,can; printf("exportadora de camaron"); printf("ingrese la cantidad"); scanf("%f",&can); printf("ingrese el codigo"); scanf("%d",&cod);
switch(cod) { case 1: printf("tipo extra"); printf("precio $3.50"); pre=3.50; tp=pre*can; printf("el total a pagar es %5.2f",tp); break; case 2: printf("tipo premiun"); printf("precio $5.50"); pre=5.50; tp=pre*can; printf("el total a pagar es %5.2f",tp); break; case 3: printf("tipo superpremiun"); printf("precio $8.50"); pre=8.50; tp=pre*can; printf("el total a pagar es %5.2f",tp); break; default: printf("error ingrese codigo del 1 al 3"); } getch(); }