This program will print the numbers 1 (not zero) through and including whatever value the user enters. HOWEVER, every value evenly divisible by 3 should print “cat” instead of the number, every value evenly divisible by 5 should print “bird” instead of the number, and every number divisible by both 3 AND 5 should print “catbird”.
This
A for loop may be handy for this since it will execute for a determined number of times (set by the user).
Sample output:
This program will print numbers and words in a strange pattern. Please enter how high you’d like the program to count.
>>>20
1
2
cat
4
bird
cat
7
8
cat
bird
11
cat
13
14
catbird
16
17
cat
19
bird
in java
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images