+ 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.
15 odpowiedzi
+ 12
It was not very difficult:
https://code.sololearn.com/cCYGv3CIKyWH/?ref=app
+ 11
In ruby
https://code.sololearn.com/cfMJ898RZzcg/?ref=app
#can be submitted as an assignment
https://www.sololearn.com/discuss/1082512/?ref=app
+ 11
here's mine😊😊
https://code.sololearn.com/caOVKSBye9Qn/?ref=app
+ 8
https://code.sololearn.com/ctJ9vAIqSlUL/?ref=app
https://code.sololearn.com/cuKBdw1dhZe2/?ref=app
https://code.sololearn.com/cFCKmqdsZ8tO/?ref=app
https://code.sololearn.com/c21TqAVoVtAs/?ref=app
+ 7
# Python
# number given as n
print(n%7==0 or str(n)[-1]==“7”)
+ 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") ;
}
}
+ 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
+ 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;
}
+ 2
https://code.sololearn.com/cy5lXTxx689V/?ref=app
+ 1
https://code.sololearn.com/c8eRLYSCW6cr/#cs
(I'll admit that I kind of copied the % part though)