Help needed

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tienzyee
    New Member
    • Oct 2006
    • 6

    #1

    Help needed

    I need to create a nested looping using for statement for this output when the input is 5. the symbol # is actually space....and if the input is 6 the program can adapt to it....

    ######1######
    #####2#2#####
    ####3###3####
    ###4#####4###
    ##555555555##

    and also this output (for another different program), input also 5(example)

    ######1######
    #####121#####
    ####12321####
    ###1234321###
    ##123454321##
  • rajesh6695
    New Member
    • Oct 2006
    • 96

    #2
    #include <stdio.h>
    #include <conio.h>
    int main()
    {
    int i,x=40,y=3,c=1;
    printf("Enter the No :");
    scanf("%d",&i);
    /*First Program */
    for(c=1;c<=i;c+ +,y++)
    {
    if(c==1)
    {
    gotoxy(x,y);
    printf("%d",c);
    }
    else
    {
    x=(x-c);
    gotoxy(x,y);
    printf("%d",c);
    x=(x+c);
    x=(x+c);
    gotoxy(x,y);
    printf("%d",c);
    x=40;
    }
    }
    getch();
    return 0;
    }




    The above code is for ur first program like a way u can try for second.......

    Comment

    Working...