facebook like button

21 January, 2014

this is a blinking christmas tree.

#include<stdio.h>
#include <time.h>
void sleep(time_t delay)
 {
  time_t timer0,timer1;
  time(&timer0);
  do{
  time(&timer1);
  }while((timer1-timer0)<delay);
 }
int main()
{

int i=5,j,k,s=0;

printf("your christmas tree is here\n");
for(k=0;k<5;k++)
printf(" ");
sleep(1);
printf("@@\n");
for(j=0;j<10;j++)
{
for(k=i;k<10;k++)
printf(" ");
i++;
if(i>10)
{
for(k=0;k<3;k++)
printf(" ");
}
sleep(1);
printf("*");
for(k=0;k<2*s;k++)
{if(2*s<10){
sleep(1);
printf("*");
}
}
if(2*s>=10)
{for(k=0;k<4;k++)
{sleep(1);
printf("*");}
}
sleep(1);
printf("*");
s++;

printf("\n");
}
return 0;
}

No comments:

Post a Comment

feel free to ask your doubts... if any
you can post your doubts on
www.facebook.com/programsimply