I have to print the powers of 10 ranging from 0-19. The problem is when I want to display the first power, which should be 1 (10^0), I just can't force printf to not repeat the 0's whatsoever. I am allowed to only use one printf in my program and one { } block (which is main function).
#include <stdio.h>
int main(void) {
int power = 19;
for (int i = 0; i <= power; i++)
printf("1%0*d\n",i, 0);
return 0;
}
My output:
10 // this should be 1, but printf still puts 0 here
10
100
1000
10000
100000
1000000
10000000
100000000
1000000000
10000000000
100000000000
1000000000000
10000000000000
100000000000000
1000000000000000
10000000000000000
100000000000000000
1000000000000000000
10000000000000000000