Answer to Question #244580 in Java | JSP | JSF for Kundie's

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
1
Expert's answer
2021-09-29T18:44:08-0400
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!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS