Buzz Number: A number is said to be Buzz Number if it ends with 7 or is divisible by 7.
Example: 1007 is a Buzz Number as it end with 7. 343 is also a Buzz Number as it is divisible by 7 and 77777 is also a Buzz Number as it ends with 7 and also it is divisible by 7.
Program:
import java.util.*;
class BUZZ
{
Scanner sc=new Scanner(System.in);
int n;
public void function( )
{
System.out.println("Enter the number:");
n=sc.nextInt();
if ( n % 10 == 7 || a % 7 == 0 )
System.out.println("Entered number is a Buzz number.");
else
System.out.println("Entered number is not a Buzz number.");
}
public static void main(String args[ ])
{
BUZZ ob = new BUZZ();
ob.function( );
}
}
Sample Output:
Enter the number:
37
Entered number is a Buzz number.
Enter the number:
21
Entered number is a Buzz number.
Enter the number:
123
Entered number is not a Buzz number.
Example: 1007 is a Buzz Number as it end with 7. 343 is also a Buzz Number as it is divisible by 7 and 77777 is also a Buzz Number as it ends with 7 and also it is divisible by 7.
Program:
import java.util.*;
class BUZZ
{
Scanner sc=new Scanner(System.in);
int n;
public void function( )
{
System.out.println("Enter the number:");
n=sc.nextInt();
if ( n % 10 == 7 || a % 7 == 0 )
System.out.println("Entered number is a Buzz number.");
else
System.out.println("Entered number is not a Buzz number.");
}
public static void main(String args[ ])
{
BUZZ ob = new BUZZ();
ob.function( );
}
}
Sample Output:
Enter the number:
37
Entered number is a Buzz number.
Enter the number:
21
Entered number is a Buzz number.
Enter the number:
123
Entered number is not a Buzz number.
n%7==0 hoga
ReplyDeleteYes
DeleteCan you please use ternery operator for this program ... i want to know its working
DeleteGoooood
ReplyDeleteThank you... This was very helpful 😊
ReplyDeleteits not compiling it shows no sign foe a plz help
ReplyDeleteUnderstood
ReplyDeleteOsm Program
ReplyDeleteOsm h
ReplyDeletea kya hh?
ReplyDeleteIf statement main a%7==0 main a kya hh?
Noob ho matlab
DeleteHow can 21 be a buzz number. Its just divisible by 7 but do not ends with 7!!!
ReplyDeleteWe can put up bar sign
DeleteNever heard of this site but it did help a lot. Thanks to ICSE JAVA👍😀😁
ReplyDeleteThat's right
ReplyDeletePls optimize the site and make it famous... Bro it is awesome....btw thanks for the answer
ReplyDeleteTysm its soo much helpful
ReplyDelete