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() // za promenu brzine izmeniti Sleep(100); na neku drugu vrednost
- {
- int n,i,cif;
- printf("Unesite N (2-25): ");
- do{
- 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);
- clrscr();
- printf("Unesite N (2-25): ");
- }while(n<=1||n>25);
- clrscr();
- if(n%2==1){
- for(i=1;i<=n;i++){
- gotoxy(40-(n+1)/2+1,13-(n+1)/2+i);
- printf("*");
- gotoxy(40+(n+1)/2-1,13+(n+1)/2-i);
- printf("*");
- Sleep(100);
- }
- for(i=1;i<=n;i++){
- gotoxy(40-(n+1)/2+i,13+(n+1)/2-1);
- printf("*");
- gotoxy(40+(n+1)/2-i,13-(n+1)/2+1);
- printf("*");
- Sleep(100);
- }
- }
- else{
- for(i=1;i<=n;i++){
- gotoxy(40-n/2,13-n/2+i);
- printf("*");
- gotoxy(40+n/2-1,13+n/2-i+1);
- printf("*");
- Sleep(100);
- }
- for(i=1;i<=n-1;i++){
- gotoxy(40+n/2-i,13-n/2+1);
- printf("*"); // gornji
- gotoxy(40-n/2+i,13+n/2);
- printf("*");
- Sleep(100);
- }
- }
- getch();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement