Skip to content

Ya-Sabyr/assignment1

Repository files navigation

Sabyr Berikuly IT-2503

Task 1:

Used recursion to divide the number by 10 until one digit remains, then printed digits in correct order during the return phase. alt text

Task 2:

Calculated the sum of array elements recursively and divided by the number of elements to get the average. alt text

Task 3:

Checked if a number is prime by recursively testing divisibility from n/2 down to 1. alt text

Task 4:

Implemented factorial using recursion where n! = n × (n-1)! with base case 0! = 1. alt text

Task 5:

Used recursive definition of Fibonacci sequence where each number is the sum of two previous ones. alt text

Task 6:

Computed power using recursion by multiplying the base number repeatedly n times. alt text

Task 7:

Printed array in reverse order by first calling recursion forward, then printing elements during backtracking. alt text

Task 8:

Checked if all characters in a string are digits using recursion and Character.isDigit(). alt text

Task 9:

Counted characters recursively by reducing the string size one by one using substring(). alt text

Task 10:

Used Euclidean algorithm recursively to find GCD: gcd(a, b) = gcd(b, a % b). alt text

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages