// Resultant Of Concurrent Coplanar Forces Ifk

#include<iostream>
#include<cmath>

using namespace std;

int main()
{
    double pi    = 3.14159;
    double toRad = pi / 180;    // conversion factor : Deg->Rad
    double toDeg = 180 / pi;    // conversion factor : Rad->Deg

    int N;  // Total number of forces
    cout << "How many forces ? : \n";
    cin >> N;

    double Fx = 0;  // Summation of Fx
    double Fy = 0;  // Summation of Fy

    double F, th;   // Each force and its angle

    for(int i = 1; i <= N; i++)
    {
        cout << "F" << i << "  :\n";
        cin >> F;

        cout << "th" << i << " :\n";
        cin >> th;

        Fx += F * cos(th * toRad);
        Fy += F * sin(th * toRad);
    }

    double R = sqrt( pow(Fx, 2) + pow(Fy, 2) );
    double thR = atan( Fy / Fx ) * toDeg;

    cout << "Resultant of forces: " << R << endl;
    cout << "Angle of resultant : " << thR << endl;

    return 0;
}
