I've actually written this exact program, although it was for the TI-83+ (and in TI-Basic.) However, I took a different approach.

Factors involve complicated thinking to me, so:

Take X, the value under the square root. If X % (Y*Y) == 0, then an answer is Y * sqrt(X) (since if X is divisible by Y squared, we can say sqrt(XYY) and pull the Y out of the radical.) I converted it to C (while sitting here):

Code:

`#include <stdio.h>`

#include <math.h>

int main()

{

int x, y;

printf("Enter a number: ");

scanf("%d", &x);

for(y = ceil(sqrt(x)); y > 1; y--)

{

if(x % (y * y) == 0) break;

}

printf("Simple form: %d * %c(%d)\n", y, 251, x / (y * y));

return 0;

}

That code has served me faithfully for many (ok, 2) years. The TI code was a bit more complicated (But also worked for cube roots, ect.). Now, if you want to literally output a 'sqrt' sign, that's a bit more complicated. You can output a 0xFB, which looks like a sqrt sign on the windows console. (But isn't very portable.) If you're in some GUI, the square root symbol is the unicode character U+221A.

sqrt(80000) = 200 * sqrt(2)

Although mine will fail on very large numbers. (>1.9B, shouldn't hurt too much.)