Given a decimal number as input, we need to write a program to convert the given decimal number into an…