Advertisement
jordanov

Untitled

Nov 22nd, 2020
332
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. #include<stdio.h>
  2.  
  3. int main () {
  4.  
  5. int i, j, max=0, min=9999, suma=0, x=0, proizvod=1; // RESET promenlivi
  6. float y=1.5;
  7. char c='@';
  8.  
  9. scanf("%d", &x);
  10.  
  11. for ( i=1 ; i <= x ; i++ ) { // i++, ++i, i+=1, i+=2; //BROI REDICI
  12. printf ("\n") ; // sluzhi za odenje nadole
  13. for ( j=1 ; j <= x ; j++ ){ // vnatreshen // KOLONI(VERTIKALI)
  14.  
  15. //if( i == 1 || j==1 || i == x || j==x ) {
  16.  
  17. if( i == 1 || i == x ) {
  18.  
  19. printf ("*" ) ;
  20. }
  21. else{
  22.  
  23. if( i==j ) // i=1 (j:1,2,3,4..10) ; i=2 (j:1,2..10)
  24. printf ("*" ) ;
  25. else
  26. if( i+j == x+1 ) // sporedna dijagonala
  27. printf ("*" ) ;
  28. else
  29. printf (" " ) ;
  30.  
  31. }
  32.  
  33.  
  34.  
  35.  
  36.  
  37. }
  38. }
  39.  
  40.  
  41.  
  42.  
  43.  
  44. return 0;
  45. }
  46.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement