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;
}
 
Ad

Advertisements

Joined
Mar 28, 2022
Messages
50
Reaction score
6
Because you haven't included an output statement.
It should go right before the return.
 
Ad

Advertisements


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

Top