Advertisement
houwenliee56

Shitty Shapes

Nov 6th, 2016
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.08 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<string.h>
  3. #include<stdlib.h>
  4. #include<ctype.h>
  5.  
  6. int main(void) {
  7.     int n;
  8.     scanf("%d", &n); fflush(stdin);
  9.     printf("\n");
  10.  
  11.     for(int i = 1; i <= n; i++ ) { //Ke samping
  12.         printf("* ");
  13.     }
  14.     printf("\n\n");
  15.     for (int i = 1; i <= n; i++) { //Ke bawah
  16.         printf("*\n");
  17.     }
  18.     printf("\n\n");
  19.  
  20.     for(int row = 1; row <= n; row++) { //Persegi
  21.         for (int col = 1; col <= n; col++) {
  22.             printf("* ");
  23.         }
  24.         printf("\n");
  25.     }
  26.     printf("\n\n");
  27.  
  28.     for(int row = 1; row <= n; row++) { //Segitiga siku2 bentuk L
  29.         for (int col = 1; col <= row; col++) {
  30.             printf("* ");
  31.         }
  32.         printf("\n");
  33.     }
  34.     printf("\n\n");
  35.     for(int row = 1; row <= n; row++) { //Segitiga siku2 dengan jumlah menurun
  36.         for (int col = 0; col <= n-row; col++) {
  37.             printf("* ");
  38.         }
  39.         printf("\n");
  40.     }
  41.     printf("\n\n");
  42.  
  43.     for(int row = 1; row <= n; row++) { // Segitiga siku2 terbalik nya L
  44.         for (int space = n-1; space >= row; space--) {
  45.             printf("  ");
  46.         }
  47.         for(int col = 1; col <= row; col++) {
  48.             printf("* ");
  49.         }
  50.  
  51.         printf("\n");
  52.     }
  53.  
  54.  
  55.  
  56.     puts("");
  57.     system("PAUSE");
  58.  
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement