Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /******************************************************************************
- Online C Compiler.
- Code, Compile, Run and Debug C program online.
- Write your code in this editor and press "Run" button to compile and execute it.
- *******************************************************************************/
- #include <stdio.h>
- int main()
- {
- int mult = 0;
- int amount, copyAmount, powerOf10 = 0;
- char unitate[10];
- scanf("%d%s", &amount, unitate);
- copyAmount = amount;
- while(copyAmount % 10 == 0){
- copyAmount /= 10;
- mult++;
- }
- printf("%d", copyAmount);
- switch(mult){
- case 1: printf("deca");
- break;
- case 2: printf("hecto");
- break;
- case 3: printf("kilo");
- break;
- case 4: printf("mega");
- break;
- case 5: printf("giga");
- break;
- }
- printf("%s", unitate);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement