How Could I Do It???

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jhozel
    New Member
    • Feb 2007
    • 2

    How Could I Do It???

    i dont know what kind of figure is this:
    1
    12
    123
    1234
    12345
    or
    54321
    4321
    321
    21
    1

    how could i do a c++ program of it???
  • rajesh6695
    New Member
    • Oct 2006
    • 96

    #2
    Code:
     #include <stdio.h> 
    #include <conio.h>
    int main()
    {
    	int i,j,k;
    	clrscr();
    	printf("Enter the No :");
    	scanf("%d",&k);
    	i=1;
    	j=i+1;
    	printf("%d\n",i);
    	do
    	{
    		for(i=1;i<=j;i++)
    		{
    			printf("%d",i);
    		}
    		j=i;
    		printf("\n");
    	}while(j<=k);
    	getch();
    	return 0;
    }
    Try this below C code...and try to do by your own for printing in reverse.....

    Comment

    • r035198x
      MVP
      • Sep 2006
      • 13225

      #3
      Guys let's make it a point to always post code using code tags.

      @OP you will do well by attempting the problem yourself first and posting your efforts.

      Comment

      Working...