#include <iostream> using namespace std; int main() { int n,a,sum=0; cout<<"please input n and a:"<<endl; cin>>n>>a; for(int i=1;i<=n;i++) { sum+=a; a=a+10*a;//不断赋值替换之前的数值 } cout<<sum<<endl; return 0; }
#include <iostream> using namespace std; int main() { int n,a,sum=0; cout<<"please input n and a:"<<endl; cin>>n>>a; for(int i=1;i<=n;i++) { sum+=a; a=a+10*a;//不断赋值替换之前的数值 } cout<<sum<<endl; return 0; }