SEARCH THE BLOG

Friday, February 1, 2013

FORLOOP

           Example of countdown using a forloop.


// countdown using a for loop

INPUT-

#include <iostream.h>
int main ()
{
for (int n=10; n>0; n--) 
{
cout << n << ", ";
}
cout << "FIRE!";
return 0;
}

OUTPUT-

10, 9, 8, 7, 6, 5, 4, 3, 2, 1, FIRE!

0 comments:

Post a Comment