Answer to Question #237043 in Java | JSP | JSF for sandyJay

Question #237043

Use methods and a loop of your choice 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-14T07:35:44-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