You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#include<stdio.h>voidmain(){
intnum1, num2;
printf("Enter two numbers:"); //input two numbers for checking the greatestscanf("%d %d",&num1, &num2); //accepts two numbers using scanf//checks if num1 greater than num2if(num1>num2){
//if yes prints num1 is greatestprintf("%d is the greatest",num1);
}
else{
//if no print num2 is greatestprintf("%d is the greatest",num2);
}
//you can add an extra else if statement to check whether both the numbers are same
}
Algorithm:
Step 1: Start
Step 2: Read two numbers store it in variables num1 and num2
Step 3: If num1 greater than num2, Display 'num1 is the greatest'