All pastes #58168 Raw Edit

Untitled

public text v1 · immutable
#58168 ·published 2006-05-22 21:44 UTC
rendered paste body
#include <iostream>
using namespace std;

int main()
{
    const float pi = 3.1415926535897932384626;
    int x = 0, y2;
    float a2, b2, y, x2;
    cout << "Enter a number\n";
    cin >> x;
    for (int a = 1; a<=1000; a++)
    {
        for (int b = 1; b<=1000; b++)
        {
            a2 = float(a);
            b2 = float(b);
            y = ((a2 * pi) / b2) * 100.00;
            y2 = int(y);
            //cout << y << " " << y2;
            if (y2 == x) {
                cout << a << " " << b << "\n";
                a = 1000;
                b = 1000;
            }
        }
    }
    system("pause");
    return 0;
}