[ create a new paste ] login | about

Link: http://codepad.org/rU7C44HL    [ raw code | output | fork ]

AnhProduction - C++, pasted on Jan 25:
#include <stdio.h>

int main()
{
 float i,j,h,n;
 begin:
	//clrscr();
	printf("\n Nhap do dai canh (2-25):");
	scanf("%f", &h);
        h=10; // VD: Nhap h=10
	if (h > 25 || h<2)
		goto begin;
        printf("\n");
	for (i=1;i<=h;i++)
		printf(" ");
	printf("*");
	printf("\n");
	n=h;
	for (j=2;j<h;j++)
	{
		n-=1;
		for (i=1;i<=n;i++)
			printf(" ");
		printf("*");
		for(i=1;i<(h-n)*2;i++)
			printf(" ");
		printf("*");
		printf("\n");
	}
	for (i=1;i<=h;i++)
	printf(" *");
	//getch();
        return 0;
 }


Output:
1
2
3
4
5
6
7
8
9
10
11
12

 Nhap do dai canh (2-25):
          *
         * *
        *   *
       *     *
      *       *
     *         *
    *           *
   *             *
  *               *
 * * * * * * * * * *


Create a new paste based on this one


Comments: