Documente Academic
Documente Profesional
Documente Cultură
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
main()
{
printf ("\tORDEN ALFABETICAMENTE POR NOMBRE JUNTO CON SU
NOTA\n\n");
int nota[5], auxNt;
char nom[5][20], auxN[20];
int rpta,i,j,k,v;
for(i=0;i<5;i++)
{
printf("Ingrese Nombre del ALumno: ");
fflush(stdin);
gets(nom[i]);
printf("Ingrese Nota: ");
scanf("%d",¬a[i]);
printf("\n");
fflush(stdout);
}
for (i=0;i<4;i++)
{ for (j=i+1;j<5;j++)
{
v = strcmp ( nom[i],nom[j] );
if (v>0)
{
auxNt = nota[i];
nota[i] = nota[j];
nota[j] = auxNt;
strcpy(auxN , nom[i]);
strcpy(nom[i], nom[j]);
strcpy(nom[j], auxN);
}
}
}
Ejercicio 3
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
void main()
{
int codigo[5]= {
001,002,003,004,005
};
char Desc[5][15] = {
"Licuadora", "Televisor", "Tostadora",
"Cafetera","Auriculares"
};
int PreUni[5] = {25, 35, 48, 87, 26};
float MontoParc, Descuento, MontoPagar;
int i,Cantidad, CantTotal, cod;
float td = 0.08;
PreUni[i]);
}
i= 0;
printf("\n");
printf("Ingrese el Codigo: ");
scanf("%d",&cod);
while ((cod != codigo[i]) && ( i<5 ))
{
i = i+1;
if (i==5)
};
else
{ printf(" Codigo: %d \t Nombre: %s \t Precio: %d \n",codigo[i],
Desc[i], PreUni[i]);
MontoParc=Cantidad*PreUni[i];
\n