Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <Windows.h>
- int main()
- {
- int n,xu,yu,cif,i,j,k;
- printf("Unesite 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>25||n%2==0);
- i=1;
- for(i=1;i<=40-n/2;i++){
- clrscr();
- gotoxy(i,13+n/2);
- for(j=1;j<=n;j++)printf("*");
- xu=wherex()-1;
- yu=wherey();
- for(j=1;j<=n/2;j++){
- yu--;
- xu--;
- gotoxy(xu,yu);
- printf("*");
- }
- for(j=1;j<=n/2;j++){
- xu--;
- yu++;
- gotoxy(xu,yu);
- printf("*");
- }
- gotoxy(81-n-i,13-n/2);
- for(j=1;j<=n;j++)printf("*");
- xu=wherex()-1;
- yu=wherey();
- for(j=1;j<=n/2;j++){
- yu++;
- xu--;
- gotoxy(xu,yu);
- printf("*");
- }
- for(j=1;j<=n/2;j++){
- yu--;
- xu--;
- gotoxy(xu,yu);
- printf("*");
- }
- Sleep(50);
- }
- gotoxy(40-n/2+2,13-n/2+1);
- xu=wherex();
- yu=wherey();
- gotoxy(1,22);
- getch();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement