Created
July 11, 2012 10:01
-
-
Save skRyo/3089396 to your computer and use it in GitHub Desktop.
fizzbuzz
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.*; | |
public class fizzbuzz { | |
public static void main(String[] args) { | |
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); | |
try { | |
String line = reader.readLine(); | |
int x = Integer.parseInt(line); | |
for(int i=1; i <= x; i++){ | |
if(i%3==0 && i%5==0){ | |
System.out.println("FizzBuzz"); | |
}else if(i%3==0){ | |
System.out.println("Fizz"); | |
}else if(i%5==0){ | |
System.out.println("Buzz"); | |
}else{ | |
System.out.println(i); | |
} | |
} | |
}catch (IOException e){ | |
System.out.println("fuck??"); | |
}finally { | |
try { | |
reader.close(); | |
} catch (IOException e) { | |
System.out.println("fuck!!"); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://gist.github.com/3089637