0% found this document useful (0 votes)
19 views2 pages

Shape (Code C Basic)

Uploaded by

tungnthe153407
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views2 pages

Shape (Code C Basic)

Uploaded by

tungnthe153407
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

#include<stdio.

h>
#include<math.h>

int main () {
printf("Nhap chieu cao tam giac can :");
int h;
scanf("%d",&h);

int i,j;
for ( i = 0 ; i <= h ; i++) {
for ( j = 0 ; j < h-i ; j++ ) {
printf(" ");
}
for ( j = 0 ; j < 2*i - 1 ; j++) {
printf("*");
}
printf("\n");
}

printf("\n");
printf("Nhap do dai hinh vuong :");
int a;
scanf("%d", &a);

for ( i = 0 ; i < a ; i++) {


for ( j = 0 ; j < a ; j++) {
printf("* ");
}
printf("\n");
}

printf ("\n");
printf("Nhap do dai hinh vuong rong :");
int b;
scanf("%d", &b);

for ( i = 0 ; i < b ; i++) {


for ( j = 0 ; j < b ; j++) {
if ( i == 0 || i == b - 1 || j == 0 || j == b - 1) {
printf("* ");
} else {
printf(" ");
}
}
printf("\n");
}

printf("\n");
printf("Nhap chieu cao tam giac nguoc :");
int heigh;
scanf("%d", &heigh);

for ( i = 0 ; i < heigh ; i++) {


for ( j = 0 ; j < i ; j++) {
printf(" ");
}
for ( j = 0 ; j < heigh - i ; j++) {
printf("* ");
}
printf("\n");
}

printf("\n");
printf("Nhap chieu cao tam giac vuong nguoc :");
int d;
scanf("%d", &d);

for ( i = d ; i >= 0 ; i--) {


for ( j = 0 ; j < d - i ; j++) {
printf(" ");
}
for ( j = 0 ; j <= i ; j++) {
printf("*");
}
printf("\n");
}
return 0;
}

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy