Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int main()
- {
- int n,xu,yu,cif,i,j;
- printf("Unesite neparan prirodan broj n: ");
- xu=wherex();
- yu=wherey();
- do{
- gotoxy(xu,yu);
- printf(" ");
- gotoxy(xu,yu);
- n=0;
- do{
- do{
- cif=getch();
- }while(((cif<'0'||cif>'9')||(n==0&&cif=='0'))&&cif!=13);
- if(cif!=13){
- n=n*10+cif-48;
- printf("%c",cif);
- }
- }while(cif!=13);
- }while(n<=5||n>=11||n%2==0);
- printf("\n\n");
- for(i=1;i<=n/2;i++)
- {
- for(j=1;j<=(3*n)/2+1-i;j++)printf(" ");
- for(j=1;j<=-1+2*i;j++)printf("*");
- printf("\n");
- }
- for(i=1;i<=n+1;i++)
- {
- for(j=1;j<=i-1;j++) printf(" ");
- for(j=1;j<=2+3*n-2*i;j++) printf("*");
- printf("\n");
- }
- for(i=1;i<=n/2;i++)
- {
- for(j=1;j<=n;j++) printf(" ");
- for(j=1;j<=n/2+1-i;j++) printf("*");
- for(j=1;j<=-1+i*2;j++) printf(" ");
- for(j=1;j<=1+n/2-i;j++) printf("*");
- printf("\n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement