Course Content
Detailed Content of Programming in C
0/1
Introduction
0/1
Structure of C program
0/1
Answers of ‘C’ Pointers Programs
0/1
About Lesson

C program that uses a function to find the maximum of two numbers.

#include <stdio.h>

// Function to find the maximum of two numbers
int findMaximum(int a, int b) {
return (a > b) ? a : b;
}

int main() {
int num1, num2;

// Taking input for two numbers
printf(“Enter the first number: “);
scanf(“%d”, &num1);

printf(“Enter the second number: “);
scanf(“%d”, &num2);

// Calling the function to find the maximum and printing the result
int max = findMaximum(num1, num2);
printf(“The maximum of %d and %d is: %dn”, num1, num2, max);

return 0;
}