#include <math.h> #include <stdio.h> int main() { int n, dummy; int x, y, cnt = 0; x = y = 2 * n; while (y > n) { double res = ((double) x / (x + y)) * y; if (res == n) { //printf("1/%d + 1/%d = 1%d\n", x, y, n); cnt++; x++; } else if (res > n) { if (newy < y) { y = newy; } else { break; } } else { if (newx > x) { x = newx; } else { break; } } } } return 0; }