Advertisement
Alx09

Untitled

Mar 12th, 2022
1,038
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.97 KB | None | 0 0
  1. /******************************************************************************
  2.  
  3.                             Online C Compiler.
  4.                 Code, Compile, Run and Debug C program online.
  5. Write your code in this editor and press "Run" button to compile and execute it.
  6.  
  7. *******************************************************************************/
  8.  
  9. #include <stdio.h>
  10.  
  11.  
  12. int main()
  13. {
  14.     int mult = 0;
  15.     int amount, copyAmount, powerOf10 = 0;
  16.     char unitate[10];
  17.     scanf("%d%s", &amount, unitate);
  18.     copyAmount = amount;
  19.     while(copyAmount % 10 == 0){
  20.         copyAmount /= 10;
  21.          mult++;
  22.     }
  23.    
  24.    
  25.     printf("%d", copyAmount);
  26.    switch(mult){
  27.         case 1: printf("deca");
  28.         break;
  29.         case 2: printf("hecto");
  30.         break;
  31.         case 3: printf("kilo");
  32.         break;
  33.         case 4: printf("mega");
  34.         break;
  35.         case 5: printf("giga");
  36.         break;
  37.     }
  38.     printf("%s", unitate);
  39.  
  40.     return 0;
  41. }
  42.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement