write a java program to display all the 'buzz numbers' between p and q (where p is less than q).A 'Buzz Number' is the number which ends with 7 or is divisible by 7.
Anonymous:
my icse exam completed some days before
Answers
Answered by
45
find the attachment!!!☺️
Attachments:
Answered by
21
Answer:
import java.util.Scanner;
public class Buzz_no
{
public static void main(String args[ ])
{
Scanner in = new Scanner(System.in);
int p,q,i;
System.out.println("Note: p should be less than q");
System.out.print("Enter p: ");
p=in.nextInt();
System.out.print("Enter q: ");
q=in.nextInt();
System.out.println("Buzz numbers between "+ p + " and " + q);
for (i=p;i<=q;i++)
{
if (i%10==7 || i%7==0)
{
System.out.println(i);
}
}
}
}
Similar questions