Answered step by step
Verified Expert Solution
Question
1 Approved Answer
c programming language. Exercise 1: Numbers operations with recursive functions (6 marks) Exercise Objectives Identifying the base case(s) and recursive step used to understand/write a
c programming language.
Exercise 1: Numbers operations with recursive functions (6 marks) Exercise Objectives Identifying the base case(s) and recursive step used to understand/write a recursive function Implementing and calling recursive function Problem Description Open replit.com IDE, create a new repl (project) and name it "Lab10Ex1". Use this project to write and run a C program that performs the following: Declare the following functions as prototype and implement them after the main function DigitsCount(), a recursive function that receives an integer number num, and returns the number of its digits. (Hint: You can use a static variable to store count] ReverseNumber(), a recursive function that receives an integer number num, and returns its reverse value. (Hint: You can use a static variable to store the result of reversing] GCD(), a recursive function that receives two integer numbers num1 and num2, and returns the GCD. (Hint: Greatest Common Divisor (GCD) or High Common Factor (HCF) of two or more integers, is the largest positive integer that divides each of the integers) GCD or HCF of two numbers in C 24 - 2 x 2 x 2 x 3 30 - 2 x 3 x 5 GCD Multiplication of common factors - 2 x 3 -6 In the main function declare two positive integers: num1 and num2, and prompt the user to read both of them, then call the functions declared above as follows: Find the number of digits for numi Test if num1 is palindrome number or no by comparing num1 with its reverse (you need to call ReverseNum() for num1.] Find the GCD(num1, num2), by calling the specified function Sample Output Please enter the First number 2552 Please enter the Second 48 The number of digits for 2552 is 4 The reverse of 2552 is 2552 2552 is a Palindrome number GCD (2552, 48) is 8 12 Please enter the First number 152 Please enter the Second number The number of digits for 152 is 3 The reverse of 152 is 251 152 is not a Palindrome number GCD (152, 12) is 4Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started