167k views
0 votes
Write a program that generate a one digit Random number that represent angle in degree. Then convert it into Radians using the following formula and display the results with two digit after the decimal point.

User Alfi
by
4.4k points

1 Answer

6 votes

Answer:

#include <iostream>

#include<iomanip>

#include<ctime>

using namespace std;

double angleRad(double a)

{

a *= 0.0175;

return a;

}

int main()

{

srand(time(0));

double angle = rand() % 10;

cout << "Angle in degrees - " << angle;

cout << "\\\\Angle in radian - " << fixed << setprecision(2) << angleRad(angle);

return 0;

}

Step-by-step explanation:

User Isaac Minogue
by
4.5k points