I need Help of experts to solve this problem

Rajinder Kaur's Avatar, Join Date: Jun 2008
Newbie Member
hello []
i have made a program but it didn't give required output []
so plz help me to get required output........


i want to get output as

1 1
1 2 2 1
1 2 3 3 2 1
1 2 3 4 4 3 2 1
1 2 3 4 5 4 3 2 1


tell me... what will be the c program to solve this problem

with regards...
satveer.sm's Avatar, Join Date: Nov 2007
Light Poster
Quote:
Originally Posted by Rajinder Kaur
hello []
i have made a program but it didn't give required output []
so plz help me to get required output........


i want to get output as

1 1
1 2 2 1
1 2 3 3 2 1
1 2 3 4 4 3 2 1
1 2 3 4 5 4 3 2 1


tell me... what will be the c program to solve this problem

with regards...
Code:
              int j;
	for(int i = 1 ; i <= 5; i++)
	{
	   for( j = 1 ; j <= i ;j++)
	   {
	   
	    printf("%d ",j);
	   
	   
	   }

	   for( j = i ; j >= 1 ;j--)
	   {
	     if(j == 5 )
	       continue;
	     printf("%d ",j);
	   
	   
	   }

	   printf("\n\n");
	
	}

Last edited by shabbir; 23Jun2008 at 20:02.. Reason: Code block