hi. can someone please explain and show to me how to make a code for this assignment(in c++): I'm given two integer numbers and i have to find out if one is the power of the other. if yes print out the degree. and the program is supposed to run repeatedly.
it is kind of hard to explain what i need because the assignment was given to me in a different language. i can try with an example: i need to put in two integer numbers, if i choose for example 8 and 2 it should print out that it is 2^3. if i put in 8 and 4 it should come out as no.
please please help. i have some ideas but i'm not sure they are correct and how exactly to write it in c++
Thank You :)
Well first you have to determine which is the largest number.
Then you need to factor that number and determine if the small number is one of those results.
If yes then you need to count the number of times the smaller number occurs.
Ok i got to the point where it tells if one number is the power if the other but I can't figure out how to write the code for it finding out in which degree. I probably need to multiply n by n till it reaches m and then count how many times did i need to multiply n but I don't know how to write it