-->
Showing posts with label to display Nepal like pattern. Show all posts
Showing posts with label to display Nepal like pattern. Show all posts

program to display following star pattern.

/*program to display following star pattern.
              *
             *     *                                                                                                  
             *            *
             *                   *
             * * * * * * * * *                
             * *
             *     *
             *         *
             *             *
             *                  *
             *  * * * * * * * *
             *
             *
             *
*/
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int i,k,m,sp=7;
//printf("first upper part");
for(i=1;i<=5;i++)
 {

for(m=i;m<= i;m++)
{
printf("*");
}
 for(m=1;m<i;m++)
 {
 printf("  ");
 }
   for(m=i;m<=i;m++)
    {
      if(m==1)
      printf(" ");
      else
      printf("*");

    }

 printf("\n");
 }
 for(i=1;i<=10;i++)
 {
 printf("*");
 }
//printf("second lower part");
for(i=1;i<=5;i++)
 {

for(m=i;m<= i;m++)
{
printf("*");
}
 for(m=1;m<i;m++)
 {
 printf("  ");
 }
   for(m=i;m<=i;m++)
    {
      if(m==1)
      printf(" ");
      else
      printf("*");

    }

 printf("\n");
 }
 for(i=1;i<=10;i++)
 {
 printf("*");
 }
  for(i=1;i<=5;i++)
 {
 printf("*\n");
 }
 getch();
 }
-------------------------------
logics in mind:-
-------------------------------
1)it contains three parts:
        first part is upper right angled triangle
        second part is lower right angled triangle
        third part is tail
If we combine them then we get that.
2) To get upper part we have already done. follow the link
            https://practicingclanguage.blogspot.com/2016/09/program-to-display-following-star_21.html
3)To get lower part, follow the link
        https://practicingclanguage.blogspot.com/2016/09/program-to-display-following-star_21.html
4) to get left part, use loop few number of times. It's done
---------------------------------------------------------------------------------
Follow following shot for more.

program screenshot:-

output screen shot:-