APL/APL1.1/CM2/conversion.c
2022-01-25 15:13:52 +01:00

19 lines
371 B
C

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main(int argc, char * argv[]){
char* temp;
char* type;
double valeur;
type = argv[2];
valeur = strtod(argv[1],&temp);
double conversion = 2.54;
if (strcmp(type,"cm")==0){
printf("%.2lf in\n",valeur / conversion);
}
if (strcmp(type,"in")==0){
printf("%.2lf cm\n",valeur * conversion);
}
return EXIT_SUCCESS;
}