+ 25

[CHALLENGE] Buzz number!

Buzz number is such a number which is either completely divisible by 7 or extreme right side digit of the number is 7. Output 1 Enter the number:63 Entered number is a Buzz number. Output 2 Enter the number:87 Entered number is a Buzz number. Output 3 Enter the number:186 Entered number is not a Buzz number.

17th Apr 2018, 12:34 PM
💞ⓢⓦⓐⓣⓘ💞
💞ⓢⓦⓐⓣⓘ💞 - avatar
15 Respuestas
17th Apr 2018, 1:36 PM
MeanMachine
MeanMachine - avatar
17th Apr 2018, 12:59 PM
Paul
Paul - avatar
17th Apr 2018, 1:13 PM
Lord Krishna
Lord Krishna - avatar
19th Apr 2018, 11:11 AM
Neelarghya Kundu
Neelarghya Kundu - avatar
+ 7
# Python # number given as n print(n%7==0 or str(n)[-1]==“7”)
17th Apr 2018, 10:46 PM
Pedro Demingos
Pedro Demingos - avatar
+ 4
//Java import java.util.Scanner ; public class Program { public static void main(String[] args) { int number ; Scanner obj = new Scanner(System.in) number=obj.nextInt(); if(number%7==0 || number%10==7) System.out.println(number+" is buzz number") ; else System.out.println(number+" is not buzz") ; } }
17th Apr 2018, 3:55 PM
Uzair
Uzair - avatar
+ 4
Here's mine. I did it so that it tells the user how much the number is off by from the last and next buzz numbers. Buzz Numbers: https://code.sololearn.com/c13d9E2gQXNW/#py
18th Apr 2018, 11:04 AM
Harvey
Harvey - avatar
+ 3
//C++ // code for buzz numbers /* buzz numbers are those which are completely divisible by 7 or give remainder 7 */ #include <iostream> using namespace std; int main() { int number ; cin>>number ; if(number%7==0 || number%10==0) { cout<<number<<" is Buzz number " ; } else cout<<number<<" is not buzz number" ; return 0; }
17th Apr 2018, 5:31 PM
Uzair
Uzair - avatar
25th Apr 2018, 1:09 PM
Jean
+ 2
https://code.sololearn.com/cy5lXTxx689V/?ref=app
29th Apr 2018, 4:35 AM
D Janapriya
D Janapriya - avatar
+ 1
https://code.sololearn.com/c8eRLYSCW6cr/#cs (I'll admit that I kind of copied the % part though)
20th Apr 2018, 2:21 PM
Mohammed A. Gomaa
Mohammed A. Gomaa - avatar