InterviewSolution
Saved Bookmarks
| 1. |
Write a program using pow() and sin() function. |
|
Answer» The pow() function returns base raised to the power of exponent. The sin() function takes a single argument in radians #include #include using namespace std; int main () { double base, exponent, result; base = 5; exponent = 4; result = pow(base, exponent); cout << “pow(“ << base << “A” << exponent <<”) = ” << result; double x = 25; result = sin(x); cout << “\nsin(“<< x <<”)= ”<< result; return 0; } Output: pow (5^4) = 625 sin (25) = – 0.132352 |
|