Saturday, May 05, 2012

C Program That Print The Triangle In Reverse Cone

Hiiiiii friends after read this code you are able to print the following pattern....

* * * * * * * * * * * * * * * * *
  * * * * * * *   * * * * * * *
    * * * * *       * * * * *
      * * *           * * *
        * * * * * * * * *
          * * * * * * *
            * * * * *
              * * *
                *


#include<stdio.h>
#include<conio.h>
int main()
{
 int i,j,k,l,m;
 clrscr();
 for(i=1;i<=17;i++)
  printf(" *");
 printf("\n");
 l=1;
 m=1;
 for(i=7;i>=3;i=i-2)
 {

  for(k=1;k<=m;k++)
   printf("  ");

  for(j=1;j<=i;j++)
   printf(" *");

  for(k=1;k<=l;k++)
   printf("  ");

  for(j=1;j<=i;j++)
   printf(" *");

  printf("\n");
  l=l+2;
  m=m+1;
 }
 l=4;
 for(i=9;i>=1;i=i-2)
 {
  for(k=1;k<=l;k++)
   printf("  ");

  for(j=1;j<=i;j++)
   printf(" *");

  printf("\n");
  l=l+1;
 }
 getch();
 return(0);
}




           ******Thanks Friends******

No comments:

Post a Comment

Please Give Me Your Views

Popular Posts