Do-while loop that counts backward. - C Statement

C examples for Statement:do while

Description

Do-while loop that counts backward.

Demo Code

#include <stdio.h>
int main()//from  w  ww.  j  a v  a 2 s .co m
{
   int start;
   printf("Please enter the number to start\n");
   printf("the countdown (1 to 100):");
   scanf("%d",&start);
   /* The countdown loop */
   do
   {
      printf("T-minus %d\n",start);
      start--;
   }
   while(start>0);
   return(0);
}

Result


Related Tutorials