Advertisement
Guest User

Untitled

a guest
Feb 19th, 2020
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.47 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main() {
  4.     int i,j,n;
  5.     do {
  6.     printf("Unesite broj N:");
  7.         scanf("%d",&n);
  8.    
  9.        
  10.         if(n%4!=1)
  11.         {
  12.        
  13.                 printf (" N nije ispravno!\n");
  14.         }
  15.            
  16.     }
  17.     while(n%4!=1);
  18.     printf("\n");
  19.     for(i=0;i<n;i++)
  20.     {
  21.         for(j=0;j<n;j++)
  22.         {
  23.             if(i%2==0 &&(j>=i-1&&j<=n-1-i||j>=n-1-i&&j<=i)||j%2==0&&(i>=j+2 &&i<=n-1-j ||i>=n-1-j &&i<=j))
  24.             {
  25.                 printf("*");
  26.             }
  27.             else
  28.             {
  29.                 printf(" ");
  30.                
  31.                
  32.             }
  33.         }
  34.         printf("\n");
  35.     }
  36.     return 0;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement