Monday, May 25, 2020

### Python program to convert decimal to binary octal and hexadecimal using function

def dec_to_binary(dec): # Function which is convert decimal to binary decimal = int(dec) print(decimal, " in Binary...

### Python program to convert decimal to binary using function

def dec_to_binary(num): #This function converts decimal number to binary and print if num > 1: ...

### Python program to convert decimal to hexadecimal using function

def dec_to_hexa(dec): d = int(dec)      #d represents decimal print(d, " in Hexadecimal : ", hex(d)) ...

### Python program to convert a decimal number to octal number using function

""" Python program to convert a decimal number to octal number without using direct functions for standard base conversions like oct()""" def dec_to_octal(n): ...

### Python program to find length of a String using function

def find_length(str): counter = 0 for i in str: ...

### Python program for swapping of two numbers using function

def swapping_numbers(num1, num2): temp=num1 num1=num2 num2=temp print("After swapping: ") ...

### Python Program to find the LCM using function

def lcm(a, b): if a > b: # choose the greater number greater = a ...

### Python program to find GCD or HCF using function

def hcf(a, b): if a > b: # choose the smaller number ...

### Python program to perform all arithmetic operations on two integers using function

def airthcalc(x,y): return x+y, x-y, x*y, x/y, x%y #_____main_____ num1=int(input("Please enter the first number: ")) num2=int(input("Please enter the second number: ")) add,sub,mult,div,mod=airthcalc(num1,num2) print("Sum of given numbers:...

### Python program to check number is prime or not using function

def prime(num): if num > 1: for i in range(2, num//2): ...

#### Stay connected

19,697Fans
2,179Followers
14,700Subscribers

### Python program to display the fibonacci sequence using recursive

def recursive_fibo(num): if num <= 1: return num else: ...

### Python program to find the product of two numbers using recursive

def mult_product(x,y): if(x<y): return mult_product(y,x) elif(y!=0): ...

### Python program to convert octal to decimal using function

def octal_to_dec(n): # Function which is convert octal to decimal num = n; dec_value = 0; ...