Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<string.h>
- #include<stdlib.h>
- #include<ctype.h>
- int main(void) {
- int n;
- scanf("%d", &n); fflush(stdin);
- printf("\n");
- for(int i = 1; i <= n; i++ ) { //Ke samping
- printf("* ");
- }
- printf("\n\n");
- for (int i = 1; i <= n; i++) { //Ke bawah
- printf("*\n");
- }
- printf("\n\n");
- for(int row = 1; row <= n; row++) { //Persegi
- for (int col = 1; col <= n; col++) {
- printf("* ");
- }
- printf("\n");
- }
- printf("\n\n");
- for(int row = 1; row <= n; row++) { //Segitiga siku2 bentuk L
- for (int col = 1; col <= row; col++) {
- printf("* ");
- }
- printf("\n");
- }
- printf("\n\n");
- for(int row = 1; row <= n; row++) { //Segitiga siku2 dengan jumlah menurun
- for (int col = 0; col <= n-row; col++) {
- printf("* ");
- }
- printf("\n");
- }
- printf("\n\n");
- for(int row = 1; row <= n; row++) { // Segitiga siku2 terbalik nya L
- for (int space = n-1; space >= row; space--) {
- printf(" ");
- }
- for(int col = 1; col <= row; col++) {
- printf("* ");
- }
- printf("\n");
- }
- puts("");
- system("PAUSE");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement