+ 31
[ASSIGNMENT] : Binary Check
The binary numeral system, or base-2 number system, represents numeric values using two symbols: 0 and 1. Write a program to check the given number is binary number or not? For Example, Is 11010 binary? true Is 11030 binary? false //Assigned in the Lessons Factory!
25 Answers
+ 10
+ 27
//mine try in java ☺
String str=new Scanner(System.in).next();
for(int i=0;i<str.length();i++)
if(!(str.charAt(i)=='0'||str.charAt(i)=='1')){ System.out.println("not binary number"); System.exit(0);}
System.out.print("is binary number");
+ 23
@Gaurav Agrawal
great, 👏
why did not you write a code, ☺
thank you for participating and support 👍
+ 23
@Shobikaj
I would like Your Answer
to be declared as The Best! 😀
Please make it Public! 😊👍
I really like your solution! 😆👍
+ 20
@Tasvir
You did Not answer the Challenge!
Read the Task ?!
CHALLENGE : Binary Check!!
Write a program to check the given number
is Binary Number or Not?
Make your code Public!
+ 18
welcome , will make code next time
//I just saw and then started typing 😅
//thnx for 4 challenge
+ 14
Here is mine:
https://code.sololearn.com/c5qkCoUf4d97
+ 12
+ 10
b=input()
print(b,not(b.replace('0','').replace('1','')))
https://code.sololearn.com/cvCE38xqCtQe/?ref=app
+ 10
My solution:
• One-liner
• No if statements
• No regExp
• 73 bytes
https://code.sololearn.com/c6qDyDIiL74c/?ref=app
+ 9
Here's my attempt. Thanks for challenge : )
https://code.sololearn.com/cxqw2zcoqzr8/?ref=app
+ 8
heres my 5 whole methods..
3 rd 1 is not supported here..
https://code.sololearn.com/cd1jh8sht4Io/?ref=app
+ 7
python oneliner:
print(not (set(input())-{'0','1'}))
+ 6
@MeanMachine
Here the simple solution of your problem I make it code in simple way.
https://code.sololearn.com/cY2l4tRB5jhy/?ref=app
+ 6
https://code.sololearn.com/cE36eu2jr9ct/?ref=app
+ 5
convert decimal into binary.
https://code.sololearn.com/cBaRUuYUnXS0/?ref=app
+ 5
https://code.sololearn.com/craHAVhTHNBy/?ref=app
+ 4
😊