Write a complete Java program to solve the following problem.
Read two positive integers from the user and print all the multiple of five in between them. You can assume the second number is bigger than the first.
For example if the first number is 1 and the second number is 10, then your program should output
5 10
Note: There is a white space in between the numbers.
Java programming
please answer ASAP before 2:30
import java.util.*;
class multiple
{
public static void main()
{
Scanner sc=new Scanner(System.in);
System.out.println("Enter the two numbers");
int m=sc.nextInt();
int n=sc.nextInt();
System.out.println("The multiples of 5 are :");
int i=0;
for(i=m;i<=n;i++)
{
if(i%5==0)
{
System.out.print(i+" ");
}
}
}
}
Note : please give a thumbs up if you like my answer and feel free to comment if you have any query I would be happy to help you
Get Answers For Free
Most questions answered within 1 hours.