Advertisement
RodneyFrancalim

Pattern

Oct 8th, 2014
356
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.37 KB | None | 0 0
  1. #include <stdio.h>  // C
  2. #include <conio.h>  // getch();
  3. #include <stdlib.h> // abs();
  4.  
  5. main()
  6. {
  7.     for(int i = 1; i <= 9; ++i)
  8.     {
  9.         for(int j = 1; j <= 10; ++j)
  10.         {
  11.             if(j <= abs(5 - i) + 1 || j >= ((5 - abs(5 - i)) * 2) + abs(5 - i))
  12.                 printf("*");                                              
  13.             else
  14.                 printf(" ");
  15.         }
  16.         printf("\n");
  17.     }
  18.    
  19.     getch();
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement