Skip to content

Instantly share code, notes, and snippets.

@0x000000AC
Created November 30, 2012 21:12
Show Gist options
  • Save 0x000000AC/4178658 to your computer and use it in GitHub Desktop.
Save 0x000000AC/4178658 to your computer and use it in GitHub Desktop.
Prints "happy birthday" 100x based on a counter in a while loop
/***********************************************
* HappyBirthday.java
* Aaron P. Clark
*
* Based on the pseudocode while loop on p.37 in Ch 2.
* prints "Happy birthday!" 100x
***********************************************/
public class HappyBirthday
{
public static void main(String args[])
{
int count;
count = 1;
while (count <=100) // For loop starts at 1 and ends at 100
{
System.out.println("Happy birthday!");
count++;
}
}
}
@Keerthi-M
Copy link

Nice one!.I'm gonna use this :) Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment