We have to find a to the power b(a^b) . but though the code is running i am getting no output .why is that can anybody tell me

Joined
May 4, 2022
Messages
1
Reaction score
0
#include <iostream>

using namespace std;

int main()
{
int a,b;
cin>>a;
cin>>b;
int ans = 1;
int i = 1;
while(i<=b){
ans = ans*a;
i++;
}

return 0;
}
 
Joined
Mar 28, 2022
Messages
82
Reaction score
11
Because you haven't included an output statement.
It should go right before the return.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top