zoi20

Untitled

Nov 8th, 2013
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.55 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main()
  5. {
  6.     int i,j,m,n;
  7.     printf("Unesite pozitivan cijeli neparan broj: ");
  8.     scanf("%d",&m);
  9.    if(m%2==0)
  10.    {
  11.        printf("Broj nije neparan");
  12.    }
  13. else
  14.    if((m<0)||m==0)
  15.    {
  16.        printf("Broj nije pozitivan");
  17.    }
  18. else if((m%2==1) && (m>0))
  19. {
  20.  
  21.    for(i=0;i<m;i++)
  22.      {
  23.          for(j=0;j<m;j++) {
  24.       if((i==j)||(m==(i+j)+1)||(j==(m/2))||(i==(m/2)))
  25.             printf("*");
  26.       else
  27.         printf(" ");
  28.          }
  29.     printf("\n");
  30.     }
  31.     }
  32.     return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment