//Respuesta 1
#include "stdio.h"
#include "stdarg.h"
#define MINDOUBLE 2.2250E-308
#define MAXDOUBLE 1.7976E+308
double min(int cont,...){
int i;
va_list L;
double menor,temp;
if (cont <=0) return MINDOUBLE;
va_start(L,cont);
menor=va_arg(L,double);
for (i=1;i
if(temp
va_end(L);
return menor;
}
int main(void){
printf("el menor valor es %f\n", min(15.6,21.2,3.6,14.9));
return 0;
}
//Respuesta 3
#include "stdio.h"
#include "stdarg.h"
#define MINDOUBLE 2.2250E-308
#define MAXDOUBLE 1.7976E+308
double min(double num,...){
va_list L;
double menor=MAXDOUBLE;
va_start(L,num);
if(num==MAXDOUBLE)return MINDOUBLE;
while(num!=MAXDOUBLE){
if(num
}
va_end(L);
return menor;
}
int main(void){
printf("el menor valor es %f\n", min(15.6,21.2,3.6,3.2,14.9,1.7976E+308));
}
//Respuesta 3
#include "stdio.h"
#include "stdarg.h"
#define MINDOUBLE 2.2250E-308
#define MAXDOUBLE 1.7976E+308
double min(const char *ctrl,...){
int i;
va_list L;
double menor=MAXDOUBLE, num;
va_start(L,ctrl);
if (ctrl[0]=='\0') return MINDOUBLE;
for(i=0;ctrl[i]!='\0'; i++){
switch(ctrl[i]){
case 'd':num=(double) va_arg(L,int);break;
case 'r':num=va_arg(L,double);
}
if (num
va_end(L);
if (menor==MAXDOUBLE) return MINDOUBLE;
else return menor;
}//fin funcion
int main(void){
printf("el menor valor es %f\n", min("rrdrr",15.6,21.2,32,3.6,14.9));
return 0;
}
No hay comentarios:
Publicar un comentario