how i repeat enter number of rows agin after output

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sharat412
    New Member
    • Oct 2014
    • 4

    how i repeat enter number of rows agin after output

    #include <stdio.h>

    int main()

    {

    int rows, a, b, space;

    printf("Enter number of rows:");
    scanf("%d", &rows);

    space = rows - 1;
    for ( b = 1 ; b <= rows ; b++ )
    {
    for ( a = 1 ; a <= space ; a++ )
    printf(" ");
    space--;
    for ( a = 1 ; a <= 2*b-1 ; a++)
    printf("#");
    printf("\n");
    }


    space = 1;
    for ( b = 1 ; b <= rows - 1 ; b++ )
    {
    for ( a = 1 ; a <= space; a++)
    printf(" ");
    space++;
    for ( a = 1 ; a <= 2*(rows-b)-1 ; a++ )
    printf("#");
    printf("\n");
    }

    {
    printf("enter number of rows");

    }
    return 0;
    }
  • sharat412
    New Member
    • Oct 2014
    • 4

    #2
    i want repeat of question after output of one is given..
    if i enter 5 as input..5 rows are generated...aft er that i want a code to ask again enter the num of rows untill i close the o/p window...guys plzz help me its my interview question

    Comment

    • sharat412
      New Member
      • Oct 2014
      • 4

      #3
      no one here to ans?????????

      Comment

      • iam_clint
        Recognized Expert Top Contributor
        • Jul 2006
        • 1207

        #4
        What you are wanting is a loop.

        Comment

        • sharat412
          New Member
          • Oct 2014
          • 4

          #5
          thanking you ...but send me code plzzz

          Comment

          • iam_clint
            Recognized Expert Top Contributor
            • Jul 2006
            • 1207

            #6
            I will not give you the answer it's easy enough I gave you what you needed to run a Google search. If this is for an interview I hate to tell you but you are not qualified for the job.

            Comment

            Working...