Advertisement
DominikPasiut

Untitled

Oct 24th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.70 KB | None | 0 0
  1. #include<stdio.h>
  2. int main()
  3. {
  4.     int i,j, bok, end;
  5.  
  6.     printf("Podaj bok kwadratu\n");
  7.     scanf("%d", &bok);
  8.  
  9.     end = bok-1;
  10.  
  11.     if(bok<=1) //tu 1 bo z jednej gwiazdki nie narysuje kwadratu
  12.     {
  13.         printf("Podaj liczbe wieksza od 1");
  14.     }
  15.     else
  16.     {
  17.         for(i=0; i<bok; i++)
  18.         {
  19.             printf("\n");
  20.             for(j=0; j<bok; j++)
  21.             {
  22.                 if(i>0 && i<end)
  23.                 {
  24.                     if(j==0||j==end)
  25.                     printf("* ");
  26.                     else
  27.                         printf("  ");
  28.                 }
  29.  
  30.                 else
  31.                 printf("* ");
  32.             }
  33.         }
  34.     }
  35.     return 0;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement