Junior 6 (functions)

1. Write a program to create a function.

Welcome Neo!

2. Write a program to create a user define function with parameters.

Please input a name: Dmytro

Welcome friend Dmytro!

3. Write a program to create a function for the sum of two numbers.

Enter a number: 5

Enter another number: 6

The sum of two numbers is: 11

4. Write a program to create a function to input a string and count number of spaces are in the string.

Please input a string: As soon as you like

4

5. Write a program to calculate the sum of elements in an array.

Input 5 elements in the array :

element - 0 : 1

element - 1 : 2

element - 2 : 3

element - 3 : 4

element - 4 : 5

element - 5 : 6

element - 6 : 7

The sum of the elements of the array is 28

6. Write a program to create a function to check whether a number is prime or not.

Input a number : 7

7 is a prime number

10. Write a program to create a function to calculate the sum of the individual digits of a given number. 

Enter a number: 2075

The sum of the digits of the number 2075 is: 14

11. Write a program to create a recursive function to find the factorial of a given number.

Enter a number: 4

The factorial of 5! is: 24