Signup/Sign In
Ask Question
Not satisfied by the Answer? Still looking for a better solution?

How to Print 5,10,15,20,...50in while loop in java

Print 5,10,15,20,...50in while loop in java
by

1 Answer

rahul07

public class Printfiveloop {

public static void main(String[] args) {

System.out.println("Pattern is: ");
for(int number=0; number<=50; number++){

//check if number is multiple of 5
if(number%5==0){
System.out.print(number+" ");
}
}

}

}

Login / Signup to Answer the Question.