C Online Compiler
Example: Greatest of Three Numbers in C using Function
C
C++
C#
Java
Python
PHP
main.c
STDIN
Run
// Greatest of Three Numbers in C using Function #include <stdio.h> // Function to find the greatest number int biggest_number(int num1, int num2, int num3) { if (num1 >= num2 && num1 >= num3) return num1; else if (num2 >= num1 && num2 >= num3) return num2; else return num3; } // It's the main function of the program int main() { int num1, num2, num3; // Step-1 Enter three integer values printf("INPUT-1: "); scanf("%d", &num1); printf("INPUT-2: "); scanf("%d", &num2); printf("INPUT-3: "); scanf("%d", &num3); // Step-2 Call the biggest_number() function and find the greatest number printf("\nGreatest Number :: %d", biggest_number(num1, num2, num3)); return 0; }
4 5 3
Output
Clear
ADVERTISEMENTS