snippetjournal

– notes, snippet codes, and my journal

Fizz Buzz Code

leave a comment »


public class FizBuzz {

public static void main(String[] args) {

for(int i = 1; i < 101; i++){
 if((i%3 == 0) && (i%5 == 0)){
 System.out.println("["+i+"]fizzBuzz");
 }else if(i%3 == 0){
 System.out.println("["+i+"]fizz");
 }else if(i%5 == 0){
 System.out.println("["+i+"]buzz");
 }else{
 System.out.println("=================["+i+"]");
 }
 }
 }
 }

Written by snippetjournal

May 6, 2012 at 9:44 am

Posted in Programming

Tagged with , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: