5.2 Exercise - Function
ā§Ģ.ā§¨ āĻ
āĻ¨ā§āĻļā§āĻ˛āĻ¨: āĻāĻāĻāĻžāĻ° āĻĄāĻŋāĻĢāĻžāĻāĻ¨āĻĄ āĻĢāĻžāĻāĻļāĻ¨ āĻāĻ° āĻŦā§āĻ¯āĻŦāĻšāĻžāĻ° (ā§§ā§Ŧ)
[5] Calculate Square [Function Prototype: int square(int)]
[6] Calculate the Average of three integer numbers [Function Prototype: float average(int, int, int)]
[7] Determine EVEN or ODD [Function Prototype: int is_even(int)]
[8] Determine Leap Year or Not [Function Prototype: int is_leap_year(int)]
[9] Find the Maximum between 2 numbers [Function Prototype: int maximum(int, int)]
[10] Define a function that takes an integer as an argument and print Fizz if it is divisible by 3, print Buzz if divisible by 5, and print FizzBuzz if it is divisible by both 3 and 5. [Function Prototype: void fizz_buzz(int)]
[11] Print the natural numbers up to N.
[12] Calculate the summation of natural numbers up to N.
[13] Calculate factorial N.
[14] Print the Multiplication Table of a given number.
[15] Print the Multiplication Table of 1 to 10.
[16] Print each divisor (or factor) of the given number.
[17] Calculate the total number of divisors of a number.
[18] Calculate the summation of divisors of a number.
[19] Define a function that takes an integer array as an argument and returns the average of all array elements.
[20] Define a function that takes an integer array as an argument and a search key value X. If X is found in the array, return the index; otherwise, return -1.
āĻ¸āĻŽāĻžāĻ§āĻžāĻ¨
[5] Calculate Square [Function Prototype: int square(int)]
[6] Calculate the Average of three integer numbers [Function Prototype: float average(int, int, int)]
[7] Determine EVEN or ODD [Function Prototype: int is_even(int)]
[8] Determine Leap Year or Not [Function Prototype: int is_leap_year(int)]
[9] Find the Maximum between 2 numbers [Function Prototype: int maximum(int, int)]
[10] FizzBuzz - Define a function that takes an integer as an argument and print Fizz if it is divisible by 3, print Buzz if divisible by 5, and print FizzBuzz if it is divisible by both 3 and 5. [Function Prototype: void fizz_buzz(int)]
[11] Print the natural numbers up to N.
[12] Calculate the summation of natural numbers up to N.
[13] Calculate factorial N.
[14] Print the Multiplication Table of a given number.
7
7 x 1 = 7
7 x 2 = 14
7 x 3 = 21
7 x 4 = 28
7 x 5 = 35
7 x 6 = 42
7 x 7 = 49
7 x 8 = 56
7 x 9 = 63
7 x 10 = 70
[15] Print the Multiplication Table of 1 to 10.
[16] Print each divisor (or factor) of the given number.
[17] Calculate the total number of divisors of a number.
[18] Calculate the summation of divisors of a number.
[19] Define a function that takes an integer array as an argument and returns the average of all array elements.
[20] Define a function that takes an integer array as an argument and a search key value X. If X is found in the array, return the index; otherwise, return -1.
Last updated