I am trying to do this program but not able to get output can anyone help me
Hi Harish,br /Use this code it will work...to get more understand on the logic i kept more spaces..if you don't want u can comment those statements.br /br //*br /Program : Pattern Program of printing... 1 2 3 2 3 4 5 4 3 4 5 6 7 6 5 4 5 6 7 8 9 8 7 6 5br /Author : Rajanikanthbr /Language: C++br /Email : rnvrk.2015@gmail.combr /*/br /br /#include<iostream>br /using namespace std;br ///1 2 3 2 3 4 5 4 3 4 5 6 7 6 5 4 5 6 7 8 9 8 7 6 5br /int main()br /{br /int num, noft; //number of timesbr /int rep=0; //repetitionbr /cout<<"How many times you want to repeat this pattern...";br /cin>>noft;br /for(int cnt=1; cnt<=noft; cnt++)br /{br /for(num=cnt; num<=cnt+rep; num++)br /cout<<num<<" ";br /for(num=num-2; num>=cnt; num--)br /cout<<num<<" ";br /cout<<" ";br /rep++;br /}br /}
Is this a pattern printing program?? Do u require this kind of single line output?
can you share ur code..? br /After reviewing I will give the solution
Use do while loop.