Tuesday, May 16, 2017

Design of rocket by mubin

#include<stdio.h>
main()
{
   int n;
   printf("Enter n: "); scanf("%d",&n);
   for(;;)
{


    for(int i=0;i<n;i++)
    {
        for(int j=1;j<=n-i;j++)
        {
            printf(" ");
        }
        for(int j=1;j<=1+i;j++)
        {
            printf("* ");
        }
        //__________________________

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

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

        //_____________________

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


        //_________
                for(int j=1;j<=1+i;j++)
        {
            printf(" ");
        }

//---------3rd and 4th
                for(int j=1;j<=1+i;j++)
        {
            printf(" ");
        }

        //---------------

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

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

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

        //________________
        printf("\n");



    }
}

}









No comments:

Post a Comment