Simple integer loop and branching statement


Discuss the below:

Q: Use a simple integer loop and branching statements to play a fictitious game of foo bar baz. Create a program that loops from 1-50 and prints each value on a separate line. Also print foo for every multple of three, bar for every multiple of five, and baz for every multiple of seven

Partial Output From the FooBarBaz program:
1
2
3 foo
4
5 bar
6 foo
7 baz
8
9 foo
10 bar
11
12 foo
13
14 baz
15 foo bar
16
and so on

Solution Preview :

Prepared by a verified Expert
JAVA Programming: Simple integer loop and branching statement
Reference No:- TGS01934475

Now Priced at $20 (50% Discount)

Recommended (93%)

Rated (4.5/5)