Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int isPowerOfTen(int x)
- {
- if ( x == 10
- || x == 100
- || x == 1000
- || x == 10000
- || x == 100000
- || x == 1000000)
- return 1;
- return 0;
- }
- int count_numbers (int num) {
- int count=0;
- if (num == 0) count++;
- while (num !=0) {
- count++;
- num/=10;
- }
- return count;
- }
- int main() {
- // int size;
- // int array[size];
- // int counter;
- // int j, l;
- l=count_numbers(size-1)-1;
- for (j=0; j<l; j++) printf(" ");
- printf("# : Value\n");
- for(counter = 0; counter < size; counter++) {
- if (isPowerOfTen(counter)) l--;
- for (j=0; j<l; j++) printf("0");
- printf("%i : %i\n", counter, array[counter]);
- }
- }
Add Comment
Please, Sign In to add comment