Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

largest of two numbers #1164

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
largest of two numbers
Program to find largest of two numbers using the if-else condition in c
  • Loading branch information
swathihb authored Oct 1, 2021
commit 9a7d1bddee98f4c97f178ed0af7b32b4e2ab8cbe
22 changes: 22 additions & 0 deletions largest of two numbers
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#include <stdio.h>
int main()
{
int num1, num2;
// Ask user to enter the two numbers
printf("Please Enter Two different values\n");
// Read two numbers from the user
scanf("%d %d", &num1, &num2);
if(num1 > num2)
{
printf("%d is Largest\n", num1);
}
else if (num2 > num1)
{
printf("%d is Largest\n", num2);
}
else
{
printf("Both are Equal\n");
}
return 0;
}