WAP to enter 2 nos. and print all nos. divisible by 5 to 10 in that range.
Answers
Answered by
1
Answer:
import java.util.Scanner;
public class HelloWorld{
public static void main(String []args){
Scanner sc=new Scanner(System.in);
int low,high;
System.out.println("Enter lower limit");
low=sc.nextInt();
System.out.println("Enter higher limit");
high=sc.nextInt();
for(int i=low;i<=high;i++)
{
if(i%5==0)
System.out.println(i+" is divisible by 5");
if(i%10==0)
System.out.println(i+" is divisible by 10");
}
}
}
Explanation:
Hope it helps :-)
Similar questions