Advertisement
Dido09

C - Inch Converter

Sep 3rd, 2022
1,056
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.43 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main()
  5. {
  6.     float inch = 0;
  7.  
  8.     float milimeters, centimeters, decimeters;
  9.  
  10.     printf("Enter inches: ");
  11.     scanf("%f", &inch);
  12.  
  13.     milimeters = inch * 25.4;
  14.     centimeters = inch * 2.54;
  15.     decimeters = inch * 0.254;
  16.  
  17.     printf("%f milimeters\n", milimeters);
  18.     printf("%f centimeters\n", centimeters);
  19.     printf("%f decimeters\n ", decimeters);
  20.  
  21.     return 0;
  22. }
  23.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement