18 lines
372 B
C
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;
|
|
} |