| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • You already know Dokkio is an AI-powered assistant to organize & manage your digital files & messages. Very soon, Dokkio will support Outlook as well as One Drive. Check it out today!

View
 

10gbCTeacher

Page history last edited by Mike Leishman 16 years, 10 months ago

C

10 Green Bottles

by Andrew Karantzis

#include <stdio.h>

int main()
{
  int numberOfBottles, i;
  numberOfBottles = 10;

  for ( i = numberOfBottles; i >= 1; --i)
  {
    if (i ==  1)
    {
      printf ("%d, green bottle sitting on the wall!n", i);
      printf ("And if one green bottle should accidentally falln");
      printf ("There'll be NO more green bottles sitting on the wall!n");
    }
    else
    {
      printf ("%d, green bottle sitting on the wall!n", i);
      printf ("And if one green bottle should accidentally falln");
      printf ("There'll be %d green bottles sitting on the wall!n", i - 1);
    }
  }       
};

Comments (0)

You don't have permission to comment on this page.