Question #244580

Use the methods and a loop to develop a program that can display multiples of 10 until 150 on a single line. For example, the output should be like : 10, 20, 30, 40_..........
................, 150

Expert's answer

package loops;

public class Loops {
    public void display(){
        for(int i=10; i<=150; i++){
            if(i % 10==0){
                System.out.printf("%d, ", i);
            }       
        }
    }
    public static void main(String[] args) {
       Loops ps = new Loops();
       ps.display();
    }   
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

LATEST TUTORIALS
APPROVED BY CLIENTS