Calculate the exponential power nn.
Program prompts user to input a positive integer n less than 10.
Program terminates if invalid number is entered.
Program then calculates the exponential power using for loop.
Finally, outputs all the preceding steps (product) leading to the result.
and this is the code i have so far:
#include <iostream>
usingnamespace std;
int main(){
int c=1,n, total;
cout<<"Please enter a possitive interger, less than 10: ";
cin>>n;
for(n=1;n<=10;){
for(c=1; c<=n; c++){
total=c*n;
cout<<n<<" ^ "<<c<<" = "<<total<<endl;
c+=1;
}
return 0;
}
}
I feel like I have the key components but they're either not arranged correctly or i'm missing one piece.