Advertisement
MikecIT

Vezba 1 // Zadatak 6

Sep 4th, 2014
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.90 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main()
  5. {
  6. int n,xu,yu,cif,i,j;
  7. printf("Unesite neparan prirodan broj n: ");
  8. xu=wherex();
  9. yu=wherey();
  10. do{
  11. gotoxy(xu,yu);
  12. printf("    ");
  13. gotoxy(xu,yu);
  14. n=0;
  15. do{
  16. do{
  17. cif=getch();
  18. }while(((cif<'0'||cif>'9')||(n==0&&cif=='0'))&&cif!=13);
  19. if(cif!=13){
  20. n=n*10+cif-48;
  21. printf("%c",cif);
  22. }
  23. }while(cif!=13);
  24. }while(n<=5||n>=11||n%2==0);
  25. printf("\n\n");
  26. for(i=1;i<=n/2;i++)
  27.     {
  28.     for(j=1;j<=(3*n)/2+1-i;j++)printf(" ");
  29.     for(j=1;j<=-1+2*i;j++)printf("*");
  30.     printf("\n");
  31.     }
  32. for(i=1;i<=n+1;i++)
  33.     {
  34.     for(j=1;j<=i-1;j++) printf(" ");
  35.     for(j=1;j<=2+3*n-2*i;j++) printf("*");
  36.     printf("\n");
  37.     }
  38. for(i=1;i<=n/2;i++)
  39.     {
  40.     for(j=1;j<=n;j++) printf(" ");
  41.     for(j=1;j<=n/2+1-i;j++) printf("*");
  42.     for(j=1;j<=-1+i*2;j++) printf(" ");
  43.     for(j=1;j<=1+n/2-i;j++) printf("*");
  44.     printf("\n");
  45.     }
  46. return 0;
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement