FizzBuzz
import java.util.*;
public class fizzbuzz {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Enter the number");
int n = sc.nextInt();
String result = (n % 3 == 0 && n % 5 == 0) ? "fizzbuzz" :(n % 5 == 0) ? "buzz" :(n % 3 == 0) ? "fizz15" : Integer.toString(n);
System.out.println(result);
}
}
Comments
Post a Comment