-->

program to display following star pattern/triangle

//program to display following star pattern/triangle
//program to display following star pattern
//              *
//           *     *                                                                                                    
//        *            *
//     *                   *
//  *                          *

//* * * * * * * * * * * * * *
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int i,k,m,sp=7;
for(i=1;i<=5;i++)
 {
     for(k=sp;k>=i;k--)
     {
       printf(" ");
     }
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(int i1=1;i1<=5;i1++)
 {

   printf(" * ");
 }

 getch();
 }
------------------------------
logic in mind
----------------------
1.)The given pattern has two parts.
          *
       *
  *
*
second 
             *
                *
                   *
                        *

and third is
 * * * * *  * * *
so for these three, we use three loops with spaces between them when we combine them.
1)since there are five asterisks we display using loop with decreasing spaces(see figure).First loop is used for number of rows used.Second loop is for space(decreasing)

2)third loop is displaying star.
3)the loop inside is for space and for right pattern display.then we display second part with increasing space between them. After that we display second part with next loop as shown below(picture).
4) In second part we use 'if' because we have to display first space rather asterisk so.

5)Now, left is last row.For this, we have used another loop as shown in picture given downside. 
---------------------------------------------------------------------------------------
more about this logic , you can understand from following screenshot.

-----------------------------------------------------------------------------------------------
program screenshot:-

output screenshot:-

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;
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("*");
 }
 getch();
 }
----------------------------------
logic in mind
-----------------------------------
1.)The given pattern has three parts.
          *
          *
          *
          *
          *
second part:

             *
                  *
                      *
                          *
third part:
            ****************
If we combine them then we get given pattern.1)so for these three, we use three loops
2)since there are five asterisks we display using loop without space(see figure).
3)then we display second part with increasing space between them. For space, we have used loop.
           This part contains 'if' because we have to decide display first space rather asterisk so.
4) In third part, we use loop to display horizontally.
     For more, look downside.
---------------------------------------------------------------------------------------
   program's screenshot: 

output's screenshot:-

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;
for(i=1;i<=5;i++)
 {
 for(k=sp;k>=i;k--)
      {
      printf(" ");
      }
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");
 }
 getch();

 }
------------------------------
logic in mind
----------------------
1.)The given pattern has two parts.
          *
       *
  *
*
and 
             *
                *
                   *
                        *
so for these two, we use two loops with spaces between them when we combine them.
2)since there are five asterisks we display using loop with decreasing spaces(see figure).
3)then we display second part with increasing space between them. After that we display second part with next loop as shown below(picture).
4) In second part we use 'if' because we have to display first space rather asterisk so.
---------------------------------------------------------------------------------------
more about this logic , you can understand from following screen shot.

output screenshot is:-