Skip to content
Tejsumeru

Thoughts Become Reality

  • Tutorials
  • Video Tutorial
  • Tutorials
  • Video Tutorial
  • Java

    Write a Java program using class that prints the numbers 1 to 50. For all multiples of 3 print “Fizz” and for all multiples of 5 print “Bizz”. For multiples of both 3 and 5 print “Fizz-Bizz”.

    December 14, 2019 - By tejsumeru.12@gmail.com

    In this program, we iterate the loop and print Fizz when the current number is multiple of 3, and print Bizz when the current number is multiple of 5, and print Fizz-Bizz when the current number is multiple of 3 and 5. The below example illustrate this. Example class FizzBizzDemo { //print fizz when number is multiply by 3 and bizz when number is multiply by 5 and for both print fizz-bizz public static void main(String args[]) { int i; for(i=0;i<=50;i++) { if(i%3==0 && i%5==0) { System.out.println(i+" - Fizz-Bizz"); } else { if(i%3==0) { System.out.println(i+" - Fizz"); } else if(i%5==0)…

    Continue Reading

Categories

  • Android With Java
  • Android With Kotlin
  • C language
  • C++ Language
  • Data Structure
  • Error Solving
  • Flutter
  • Go Lang
  • Interview Quetions
  • Java
  • Javascript
  • Kotlin
  • Machine Learning
  • MATLAB
  • PHP
  • Python
  • SciPy
  • Tutorials
  • Wordpress
Graceful Theme by Optima Themes