5.1 Types of User Defined Function
ā§Ģ.ā§§ āĻĒā§āϰāĻāĻžāϰāĻā§āĻĻ: āĻāĻāĻāĻžāϰ āĻĄāĻŋāĻĢāĻžāĻāύāĻĄ āĻĢāĻžāĻāĻļāύ (ā§Ē)
[1] Write a user-defined function that prints "Hello World" inside the function [Function Prototype: void print_hello(void)]
[2] Pass an integer number to a user-defined function and print the given integer number inside the function [Function Prototype: void print_int(int)]
[3] Write a user-defined function that takes input of an integer number inside the function and returns the number [Function Prototype: int input_int()]
[4] Calculate the summation of two integer numbers using a user-defined function and return the result [Function Prototype: int summation(int, int)]
āϏāĻŽāĻžāϧāĻžāύ
[1] Write a user-defined function that prints "Hello World" inside the function [Function Prototype: void print_hello(void)]
#include<stdio.h>
void print_hello(void); // Function Prototype
int main(){
print_hello(); // Function Calling
return 0;
}
// Function Definition
void print_hello(void){
printf("Hello World\n");
}[2] Pass an integer number to a user-defined function and print the given integer number inside the function [Function Prototype: void print_int(int)]
[3] Write a user-defined function that takes input of an integer number inside the function and returns the number [Function Prototype: int input_int()]
[4] Calculate the summation of two integer numbers using a user-defined function and return the result [Function Prototype: int summation(int, int)]
Last updated