WAP to print a series. 5, 10, 15, 20, …… 50

3 years ago
OOP Java

Compile code:

public class Printfivelopp {

    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+" ");
            }
        }

    }

}

 

Output:

 

0
Dipti KC
Jan 8, 2023
More related questions

Questions Bank

View all Questions