Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

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 4

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design And SQL For DB2

Authors: James Cooper

1st Edition

1583473572, 978-1583473573

More Books

Students also viewed these Databases questions

Question

1. Identify three communication approaches to identity.

Answered: 1 week ago

Question

d. Who are important leaders and heroes of the group?

Answered: 1 week ago

Question

3. Describe phases of minority identity development.

Answered: 1 week ago