Showing posts with label Star Patterns. Show all posts

50. Heart Shape using *'s as shown below.

Thursday, February 4, 2016
Posted by Unknown


 
Ans:
#include <stdio.h>

int main()
{
    int i, j, n;

    printf("Enter value of n : ");
    scanf("%d", &n);

    for(i=n/2; i<=n; i+=2)
    {
        for(j=1; j<n-i; j+=2)
        {
            printf(" ");
        }

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

        for(j=1; j<=n-i; j++)
        {
            printf(" ");
        }

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

        printf("\n");
    }

    for(i=n; i>=1; i--)
    {
        for(j=i; j<n; j++)
        {
            printf(" ");
        }

        for(j=1; j<=(i*2)-1; j++)
        {
            printf("*");
        }

        printf("\n");
    }

    return 0;
}


 **********OUTPUT********** 
Enter value of n : 10

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

 
Ans:
#include<stdio.h>
int main()
{
int i,j,k,l,m,n,o,p,q,r,s,t;
printf("\n\n\n\n\n");

for(i=0;i<15;i++)
printf(" ");
printf("*         *\n");

for(j=0;j<13;j++)
printf(" ");
printf("*   *     *   *\n");

for(k=0;k<11;k++)
printf(" ");
printf("*      *   *      *\n");

for(l=0;l<11;l++)
printf(" ");
printf("*       * *       *\n");

for(m=0;m<11;m++)
printf(" ");
printf("*        *        *\n");

for(n=0;n<11;n++)
printf(" ");
printf("*                 *\n");

for(o=0;o<12;o++)
printf(" ");
printf("*               *\n");

for(p=0;p<13;p++)
printf(" ");
printf("*             *\n");

for(q=0;q<14;q++)
printf(" ");
printf("*           *\n");

for(r=0;r<15;r++)
printf(" ");
printf("*         *\n");

for(s=0;s<17;s++)
printf(" ");
printf("*     *\n");

for(t=0;t<20;t++)
printf(" ");
printf("**\n");
return 0;
}


 **********OUTPUT********** 

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

48.Star Shape using *'s as shown below.

Wednesday, February 3, 2016
Posted by Unknown
SmeleBD

 
Ans:
#include<stdio.h>
int main()
{
    int i,j;

    for(i=1;i<=5;i++)
    {
        for(j=16;j>=i;j--)
        {
            printf(" ");
        }
        for(j=1;j<=i;j++)
        {
            printf(" *");
        }
        printf(" \n");
    }


    for(i=1;i<=6;i++)
    {
        for(j=1;j<=i;j++)
        {
            printf(" ");
        }
        for(j=16;j>=i;j--)
        {
            printf(" *");
        }
        printf("\n");
    }
    //////////////////////////////////////

    for(i=12;i<=16;i++)
    {
        for(j=17;j>i;j--)
        {
            printf(" ");
        }
        for(j=1;j<=i;j++)
        {
            printf(" *");
        }
        printf("\n");
    }
    ////////////////////////////////////////////

        for(i=5;i>=1;i--)
        {
           for(j=16;j>=i;j--)
           {
                printf(" ");
           }
           for(j=1;j<=i;j++)
           {
                printf(" *");
           }
        printf(" \n");
        }
}


 **********OUTPUT********** 
SmeleBD

 
  *************************
Welcome to My Blog

Popular Post

Blogger templates

Powered by Blogger.

Author Info

Blogroll

Blogroll

Slider[Style1]

Image Documents

View more

Popular Posts

Total Pageviews

Blog Archive

Blog Archive

Komentar

Artikel Terbaru

About me

Facebook

Advertise

Recent Posts

Search This Blog

Recent Posts

Headline

Sponsor

Video Of Day

Text Widget

Sample Text

Contact Us

Name

Email *

Message *

Followers

Labels

Site Links

Join the Team

Social Icons

Find Us On Facebook

Flickr Images

Social Media

Pages

Join with us

Popular Posts

Legal Documents

View more

Popular Posts

Getting Started

View more

- Copyright © SmileBD -Robotic Notes- Powered by Blogger - Designed by Johanes Djogan -