#include <stdio.h> #define LIM 8 int monedas[LIM]= {500, 200, 100, 50, 25, 10, 5, 1}; main() { int num , cantidad, monedas; printf ("Introduzca el importe exacto: "); scanf ("%d", &cantidad); printf ("El cambio en monedas exactas es el siguiente : \n"); for (num=0; num main(void) { int potencia,e; potencia=1; e=0; while(potencia<=8) { potencia=potencia*2; e=e+1; //e es el exponente } printf("%d",e); getch (); return 0; } #include <stdio.h> #define MAX_RADIO 4.0 #define PI 3.141592 double AreaEsfera(double radio); main(){ double radio; puts("Esfera"); for (radio=0.0; radio <= (double) MAX_RADIO; radio +=0.2) volumen = printf("\t%6.2lf\t%6.3lf\t%6.3lf\n",radio,AreaCirculo(radio),AreaEsfera(radio)); } double AreaCirculo(double radio) {
double area; area = PI * (radio * radio); return(area); } double AreaEsfera(double radio) { double area; area = 4.00 * PI * (radio * radio); return(area); } double radio; puts("\n\t=== Tabla de Areas ===\n"); puts("\tRadio\tCirculo\tEsfera"); puts("\t-----\t-------\t------"); for (radio=0.0; radio <= (double) MAX_RADIO; radio +=0.2) printf("\t%6.2lf\t%6.3lf\t%6.3lf\n",radio,AreaCirculo(radio),AreaEsfera(radio)); } double AreaCirculo(double radio) { double area; area = PI * (radio * radio); return(area); } double AreaEsfera(double radio) { double area; area = 4.00 * PI * (radio * radio); return(area); } { double radio; puts("\n\t=== Tabla de Areas ===\n"); puts("\tRadio\tCirculo\tEsfera"); puts("\t-----\t-------\t------"); for (radio=0.0; radio <= (double) MAX_RADIO; radio +=0.2) printf("\t%6.2lf\t%6.3lf\t%6.3lf\n",radio,AreaCirculo(radio),AreaEsfera(radio)); } double AreaCirculo(double radio) { double area; area = PI * (radio * radio); return(area); } double AreaEsfera(double radio) { double area; area = 4.00 * PI * (radio * radio); return(area); }