[ create a new paste ] login | about

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

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

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

	unsigned i, j; // worked variables
        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;
		}
	}

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

	return 0;
}
		


Output:
1
2
3
4

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


Create a new paste based on this one


Comments: