Hi,
Have a look at the code
Code:
/* prorgram to print output
********
*** ***
** **
* *
--------------------------------------------------------
*/
#include<stdio.h>
int main()
{
int x,rows,columns;
printf("Enter the number of columns :");
scanf("%d",&x);
for (rows=0;rows<=x;rows++)
{
for (columns=1;columns<=x;columns++)
if (columns<=x-rows)
/*printf("*");*/
printf("%d",columns);
else
printf(" ");
printf("\n");
}
getchar();
}
I know it is similar to printing out 12344321 ,123 321,12 21 and so on.
As you can see the first part of printing out 1234 followed by the other lines is something I cud figure out but the way to figure out printing the reverse is something I am unable to wrap my head around.I am pretty sure it can be solved by the use of a % or / operator(dont know which one for sure).
All I am looking for is for some one to guide me as to how to achieve the answer.
Thanks in advance