File tree Expand file tree Collapse file tree 4 files changed +26
-0
lines changed Expand file tree Collapse file tree 4 files changed +26
-0
lines changed Original file line number Diff line number Diff line change 1+ x = input ()
2+ ans = 1
3+ while (x > 0 ):
4+ ans *= x
5+ x -= 1
6+
7+ print ans
Original file line number Diff line number Diff line change 1+ #Taking user input
2+ num = input ('Enter number: ' )
3+
4+ #Diplay the output
5+ print ('The binary equivalent is {0}' .format (bin (int (num ))[2 :]))
Original file line number Diff line number Diff line change 1+ def convertToBinary (n ):
2+ """Function to print binary number
3+ for the input decimal using recursion"""
4+ if n > 1 :
5+ convertToBinary (n // 2 )
6+ print (n % 2 ,end = '' )
7+
8+ # decimal number
9+ #Taking user input
10+ num = input ('Enter number: ' )
11+
12+ #Diplay the output
13+ convertToBinary (int (num ))
Original file line number Diff line number Diff line change 1+
12#program to find the factorial of a number provided by a user
23
34if __name__ == "__main__" :
You can’t perform that action at this time.
0 commit comments