Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This program will print out the logarithm of a number to a given base. Your prog

ID: 3541819 • Letter: T

Question

This program will print out the logarithm of a number to a given base. Your program

should read two numbers from standard input:

1. The first number is a positive floating point number for which your program will

compute the logarithm.

2. The second number is a positive floating point number that represents the base

to which the logarithm will be taken.

See page 93 in your book for a description of how to compute a logarithm to a

particular base.

Your program should emit appropriate prompts and also include a description with its

output.

Explanation / Answer


#include<iostream>
#include<math.h>
using namespace std;
int main()
{
double number;
double base;
cout << "Enter positive floating point number :";
cin >> number;
cout << endl;
cout << "Enter positive floating point number that represents the base :";
cin >> base;
cout << endl;
cout << "log " <<number << " base " << base << " is given by " << log(number)/log(base) << endl;
return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote