C++ Looping / Array -
can me im having hard time problem.
create program accept positive integer, n, , outputs combination of 2 positive integers sums .
sample output:
enter number: 10
10 defrayed as:
1+9 2+8 3+7 4+6 5+5
note: using loop or array
thank help!!
int main(){ int n; cout<<"enter number: "; cin>>n; cout<<n<<" defrayed as"<<endl; for(int i=1;i<=n/2;i++){ cout<<i<<"+"<<n-i<<" "; } cout<<endl; }
Comments
Post a Comment