[ create a new paste ] login | about

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

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

int main(void)
{
	
	unsigned n = 15; // multiplier divide value
        // worked variables
	unsigned i, j; 
        unsigned two = 0;
        unsigned five = 0;

	i = 1;

	while(n!=1) {
		i++;
		while((n%i==0)) {
			if(i==2) two++;
			else if(i==5) five++;
			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

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


Create a new paste based on this one


Comments: