Created
October 31, 2021 04:35
-
-
Save bharathmuddada/0d8c540878e739ca2bdf2d69e634b7b4 to your computer and use it in GitHub Desktop.
FizzBuzz in Java
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
| public class FizzBuzz { | |
| public static void main(String [] args){ | |
| Scanner scanner = new Scanner(System.in); | |
| System.out.println("Number"); | |
| int Number = scanner.nextInt(); | |
| if(Number%3==0 && Number%5==0) | |
| System.out.println("FIZZBUZZ"); | |
| else if(Number%5==0) | |
| System.out.println("FIZZ"); | |
| else if(Number%3 ==0) | |
| System.out.println("Buzz"); | |
| else | |
| System.out.println(Number); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment