Last active
August 29, 2015 14:08
-
-
Save syntaxerrormmm/a7bc68078f8d1f86475b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#define DIVISORE 10 | |
int main(int argc, char *argv[]) { | |
int numero, contatore, operando, totcifre, zeri; | |
do scanf("%d %d", &numero, &totcifre); | |
while (numero <= 0 || totcifre <= 0); | |
contatore = 1; | |
operando = numero; | |
while (operando / DIVISORE > 0) { | |
operando = operando / DIVISORE; | |
contatore++; | |
} | |
zeri = totcifre - contatore; | |
while (zeri > 0) { | |
printf("0"); | |
zeri--; | |
} | |
printf("%d\n", numero); | |
return 0; | |
} | |
// vim:sts=3:sw=3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment