Skip to content

Instantly share code, notes, and snippets.

@bonface221
Created April 2, 2025 11:15
Show Gist options
  • Save bonface221/1d15dd46d79a403affca62724abd1321 to your computer and use it in GitHub Desktop.
Save bonface221/1d15dd46d79a403affca62724abd1321 to your computer and use it in GitHub Desktop.
Checking the greatest number in C
#include <stdio.h>
int max(int num1, int num2, int num3)
{
if (num1 > num2 && num1 > num3)
{
return num1;
};
if (num2 > num1 && num2 > num3)
{
return num2;
};
return num3;
}
int main()
{
printf("Answer: %d\n", max(10, 40, 50));
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment