1. Trang chủ
  2. » Kỹ Thuật - Công Nghệ

Lab 7 recursive functions

2 1 0

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Course Programming Fundamentals (C language) 1 LAB 7 – Recursive Functions Main content 1 Get used to recursion 2 Get used to recursive function definitions and function calls 3 Start more complex dat[.]

Course: Programming Fundamentals (C language) LAB – Recursive Functions Main content: Get used to recursion Get used to recursive function definitions and function calls Start more complex data processing Check coding styles Practice: Get used to recursion 1.1 Write the base cases and recursive cases of each recursive function used for the following problems using pseudo codes in their corresponding programs: 1.1.1 1.1.2 1.1.3 1.1.4 Print all the Fibonacci numbers that are less than a given natural number Print all the perfect numbers that are less than a given natural number Print all the prime numbers that are less than a given natural number Print all the symmetric integer numbers from N integer numbers randomly generated from -1000000 to 1000000 Examples of a symmetric integer number are given as: -219989912; -5; 1; 202; 145541; 2389832; … Get used to recursive function definitions and function calls 2.1 Write a C program using recursive functions to get a natural number, N > 0, input by a user from the keyboard 2.2 Write a C program using recursive functions to find the greatest common divisor of two natural numbers 2.3 Write a C program using recursive functions to check if an integer number has a sum of all the even digits equal to another sum of all the odd digits 2.4 Write a C program using recursive functions for each aforementioned problem Please populate data for the inputs of each program by yourselves for illustration if needed Start more complex data processing 3.1 Write a C program using recursive functions to print all the positions of the smallest digit in an integer number input by a user from the keyboard It is supposed that the most left digit is counted at position from the left to the right How many positions are there? 3.2 Write a C program using recursive functions to approximate a value of the following functions where x is a floating-point number in [0, 1] and N is a natural number for controlling an approximation accuracy: n

Ngày đăng: 11/04/2023, 18:46

Xem thêm:

w