Java BizzBuzz Program:
package javaapplication22;
public class BizzBuzzDemo {
public static void main(String[] args) {
for(int i=1;i<=50;i++){
if(i%3==0){
System.out.println("Bizz"+i);
}else if(i%5==0){
System.out.println("Buzz"+i);
}else if(i%3==0 && i%5==0){
System.out.println("BizzBuzz"+i);
}else{
System.out.println(i);
}
}
}
}
OUTPUT:
1
2
Bizz3
4
Buzz5
Bizz6
7
8
Bizz9
Buzz10
11
Bizz12
13
14
Bizz15
16
17
Bizz18
19
Buzz20
Bizz21
22
23
Bizz24
Buzz25
26
Bizz27
28
29
Bizz30
31
32
Bizz33
34
Buzz35
Bizz36
37
38
Bizz39
Buzz40
41
Bizz42
43
44
Bizz45
46
47
Bizz48
49
Buzz50
0 comments:
Post a Comment