DEV_BUT1/DEV1.1S/Controle_Blanc/Exo1.c
2023-02-08 11:18:16 +01:00

18 lines
372 B
C

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char const *argv[])
{
if (strcmp(argv[2], "cm") == 0){
double val =strtod(argv[1], NULL);
val = val / 2.54;
printf("%.2lf%s", val,"in");
}
if (strcmp(argv[2], "in") == 0){
double val = strtod(argv[1], NULL);
val = val*2.54;
printf("%.2lf%s",val,"cm");
}
return EXIT_SUCCESS;
}