hey guys lol i spent 5 hrs thinking about building this asterick pattern and i am still getting troubled by the spacing for the 3rd pattern , anyone can help me to reduce 1 spacing so the 3rd pattern isn't out of place?XD

#include <stdio.h>


int main()
{
   int c,c_2,c_3,c_4,c_5,c_6,c_7,c_8;
     for(c=1;c<=10;c++)
       {
        for (c_2=1;c>=c_2;c_2++)
         printf ("*");
       printf("\n");
      }
      printf("\n");
      getch();

         for(c_3=1;c_3<=10;c_3++)
          {
          for(c_4=10;c_3<=c_4;c_4--)
             printf("*");
           printf("\n");
           }
           printf("\n");
      getch();

        for(c_5=1; c_5<=10;c_5++)
          {
            for(c_6=c_5;c_6>=1;c_6--)
              printf(" ");
              for(c_6=10;c_6>=c_5;c_6--)
             printf("*");
             printf("\n");
            }
            printf("\n");
          getch();

            for(c_7=1; c_7<=10;c_7++)
            {
              for(c_8=c_7; c_8<10; c_8++)
                 printf(" ");
               for(c_8=1; c_8<=c_7;c_8++)
                printf("*");
                printf("\n");
            }
            printf("\n");
        getch();
     return 0;
}

This coding is the problem :( lol any ideas?:D

for(c_5=1; c_5<=10;c_5++)
          {
            for(c_6=c_5;c_6>=1;c_6--)
              printf(" ");
              for(c_6=10;c_6>=c_5;c_6--)
             printf("*");
             printf("\n");
            }
            printf("\n");
          getch();

Recommended Answers

All 2 Replies

for(c_5=1; c_5<=10;c_5++)
          {
            for(c_6=c_5;c_6>=1;c_6--)
              printf(" ");
              for(c_6=10;c_6>=c_5;c_6--)
             printf("*");
             printf("\n");
            }
            printf("\n");
          getch();

initialize c_5 to 0 instead of 1.

for(c_5=0; c_5<=10;c_5++)

initialize c_5 to 0 instead of 1.

for(c_5=0; c_5<=10;c_5++)

thanks alot !! Xd

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.