# Basic Questions on Functions in C

1. Create a function to print Welcome ( without any return data to main() function )
2. Create a function to display sum of two integers, printf() should be inside the function.
3. Create a function to display square of 5 ( without any return data to main() function )
4. Take one user input number and pass it to a function to display the same by adding 10 to its value.
5. Create a function to return square of 5 to main function and then display by using printf
6. Create a function to receive number 5 as parameter and return square of it to main function. Display the return value using printf() inside main() function.
7. Ask user to enter one number and then use the function to display square of it inside the function without returning any data to main function.
8. Ask user to enter one number, pass this number to a function, return the number to main function after adding 10 to the value.
9. Ask the user to input two numbers and display the sum of it ( without using any function )
10. Ask the user to input two numbers and display the sum of it inside a function ( without returning any data to main() )
11. Ask for two user input numbers, pass to a function and then display highest number.
12. Ask for two user input numbers, pass to a function and then return highest number to main function.
13. Ask for two user input numbers, pass to a function and then return highest number to main function. Display the highest number inside main function.
14. Ask the user to input two numbers and return the sum to main() by using a function and then inside the main() display the result after multiplying the sum by 2.
15. Ask user to enter three numbers then pass the value to a function. Add three numbers inside the function and return the result to main function. Inside main function display the result by adding 10 to it.
16. Enter your car number ( only number part ) , then enter day number starting from 1 to 7 ( day number of the week ). Your program should say you should go out in your car or not. All even day numbers are mean for cars with even numbers and odd car numbers are for odd day numbers.
17. Declare a variable num1 equal to 5 inside main() function. Create one more function my_fun() and display the value of num1 inside it. ( Don’t declare num1 again inside the my_fun() )
18. Declare a variable num1 equal to 5 inside main() function. Create one function my_fun() and declare variable num1 equal to 100 and display the value of num1 inside it. Check the output.
19. In above code , add 100 to num1 after declaring inside my_fun() and display the value.
20. In above code call the function two times in main function and check the value it displays.
21. How the value will change in above code if you declare num1 as static variable.
22. Find out the lowest common factor ( LCF ) of two input numbers.
23. Find out highest common factor ( HCF ) or greatest common factor of two input numbers.
Find the solutions by using recursive functions
1. User input one positive integer n, Create a function to find sum of all numbers upto n.
Sum = n+(n-1)+(n-2)… +2+1+0
2. Find the factorial of a input positive number. ( Factorial of a number ( n ) is product of all the integers from 1 to n )
3. Find out highest common factor ( HCF ) or greatest common factor of two input numbers.

## Subscribe

* indicates required
Subscribe to plus2net

plus2net.com