[ create a new paste ] login | about

Link: http://codepad.org/A0jg5wRm    [ raw code | output | fork ]

nel - C, pasted on Sep 8:
#include <stdio.h>

int main(void)
{
	
	unsigned n = 15; // multiplier divide value

	unsigned i, j; // worked variables
    unsigned two = 0;
    unsigned five = 0;

	i = 6;

	while(n!=1) {
		i--;
		while((n%i==0)) {
			if(i==2) two++;
			else if(i==5) five++;
			n/=i;
		}
		printf("* step [%d] done...\n", i);
	}

        if(i==2) i/=i;
        if(i==5) i/=i;

	printf("\ntwo: 2^%d", two);
	printf("\nfive: 5^%d", five);
	printf("\nreduce: *%d", i);

	return 0;
}
		


Output:
1
2
3
4
5
6
7
* step [5] done...
* step [4] done...
* step [3] done...

two: 2^0
five: 5^1
reduce: *3


Create a new paste based on this one


Comments: