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
7 Answers
+ 4
@John Wells
š I really respect your sincere
@Sc4r May I ask what is your purpose?
+ 2
Does iv stop you from using System.out.println?
+ 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
+ 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();
}
}
}
}
0
@ john wells System.out.print () cant be used
u van use S.o.pln(
- 4
Inappropriate content