need help in c++!! program to reverse pyramid of numbers
#include <iostream> using namespace std; int main() { int rows,i,j,space; cout<<"Enter number of rows: "; cin>>rows; for(i=rows;i>=1;--i) { for(space=0;space<rows-i;++space) cout<<" "; for(j=i;j<=2*i-1;++j) cout<<"* "; for(j=0;j<i-1;++j) cout<<"* "; cout<<endl; } return 0; } Is that what your looking for?
no i want the output as 4 5 6 2 3 1
cn u help me?
So you want to turn 1 2 3 4 5 6 into 4 5 6 2 3 1? Is that the numbers you must work with or must your code allow entry of numbers? Do you need to reverse the numbers in arrays or for display only? If it's for display only it should be pretty simple.
Join our real-time social learning platform and learn together with your friends!