Untitled
unknown
plain_text
8 months ago
663 B
8
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[i]* x ^ n"; for(i=0; i<=10; i++){ cout << "\ninput a value for n\n"; cin >> n; if(n<0 || n>10 ){ exit(1); } cout << "\ninput a value for a[i]\n"; cin >> a[i]; cout << "\ninput a value for x\n"; cin >> x; p = a[i]*pow(x,n); cout << "p=" << p; } return 0; }
Leave a Comment