Skip to content

Instantly share code, notes, and snippets.

@syntaxerrormmm
Last active August 29, 2015 14:08
Show Gist options
  • Save syntaxerrormmm/a7bc68078f8d1f86475b to your computer and use it in GitHub Desktop.
Save syntaxerrormmm/a7bc68078f8d1f86475b to your computer and use it in GitHub Desktop.
#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