Untitled

mail@pastecode.io avatar
unknown
plain_text
2 months ago
511 B
2
Indexable
Never
#include <iostream>
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstdlib>

using namespace std;
int n,x,p,i;
double a[10];


int main() {
    cout << "p = a[n]* x ^ n";
   
    for(i=0; i<=10; i++){
         cout << "\ninput a value for n and x respectively\n";
         
        cin >> n;
        a[i] = n;
        
        cin >> x;
        p = a[i]* pow(x,n);
        
        cout << p;
        
        
        if(n<0){
            exit(1);
        }
    }
    
    
 

    return 0;
}
Leave a Comment