#include<iostream> using namespace std; void main() { double a,d; int b; cout<<"*********nth square********"<<endl<<endl; cout<<"enter number for which power is to be taken"<<endl; cin>>a; cout<<"enter the power you want to take for the entered number"<<endl; cin>>b; if(b==2) { d=a*a; cout<<"square of entered number = "<<d<<endl; } else if(b==3) { d=a*a*a; cout<<"cube is "<<d<<endl; } }
i want that that it should work as "a" should be multiplied by it self as many times as
"b" is entered by the user. how can i do it, i cant understand what codition or loop to use here??