Quiz no 1 from me😆 hope you will like it | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Quiz no 1 from me😆 hope you will like it

Print 1 to 100 according to following order:- i》when no is divisible by 3;print " fizz" insted of number ii》When no. is divisible by 5; print " bizz" instead of number iii》When no. is divisible by both 3&5; print "fizz&bizz" instead of number iv》 You cannot use System.out.print() v》You cannot use a condition more than once eg- You can't use (i%3==0) & (i%3!=0) and claim as different conditions THAT'S ALL Hope the best player win I'll post the answer of the question after 30th of september this yr

23rd Sep 2017, 4:18 PM
Anirban Mukherjee
Anirban Mukherjee - avatar
7 Answers
23rd Sep 2017, 4:33 PM
Мг. Кнап🌠
Мг. Кнап🌠 - avatar
+ 4
@John Wells 😉 I really respect your sincere @Sc4r May I ask what is your purpose?
23rd Sep 2017, 5:08 PM
Yanothai Chaitawat
Yanothai Chaitawat - avatar
+ 2
Does iv stop you from using System.out.println?
23rd Sep 2017, 4:24 PM
John Wells
John Wells - avatar
+ 2
If this programming challenge is inappropriate so is your post in the first topic and this other ongoing topic. https://www.sololearn.com/Discuss/736667/?ref=app https://www.sololearn.com/Discuss/731820/challange-circular-prime
23rd Sep 2017, 5:03 PM
John Wells
John Wells - avatar
+ 2
import java.io.FileDescriptor; import java.io.PrintStream; import java.io.FileOutputStream; import java.io.IOException; public class Program { public static void main(String[] args) { PrintStream stream = new PrintStream(new FileOutputStream(FileDescriptor.out)); for(int i = 1; i < 101; ++i) { String word = String.valueOf(i); if ((i/3.0) == Math.floor(i/3.0)) { word = "fizz"; if ((i/5.0) == Math.floor(i/5.0)) { word += "&bizz"; } } else if (i%5 == 0)) { word = "bizz"; } try { String output = word + "\n"; stream.write(output.getBytes()); } catch (IOException e){ e.printStackTrace(); } } } }
23rd Sep 2017, 6:04 PM
ChaoticDawg
ChaoticDawg - avatar
0
@ john wells System.out.print () cant be used u van use S.o.pln(
23rd Sep 2017, 5:49 PM
Anirban Mukherjee
Anirban Mukherjee - avatar
- 4
Inappropriate content
23rd Sep 2017, 4:33 PM
Sc4r
Sc4r - avatar