Vaidikalaya

Find Greatest Number

In C language
#include<stdio.h>
int main(){
    int num1,num2,num3;
    printf("Enter Three Number: ");
    scanf("%d %d %d",&num1,&num2,&num3);
    if(num1>num2 && num1>num3){
        printf("%d is the greatest number",num1);
    }
    else if(num2>num1 && num2>num3){
        printf("%d is the greatest number",num2);
    }
    else if(num3>num1 && num3>num2){
        printf("%d is the greatest number",num3);
    }
    else{
        printf("all numbers are equal");
    }
}


In C++ language
#include
using namespace std;
int main(){
    int num1,num2,num3;
    cout<<"Enter Three Numbers: ";
    cin>>num1>>num2>>num3;
    if(num1>num2 && num1>num3){
        cout<<num1<<" is the greatest number";
    }
    else if(num2>num1 && num2>num3){
        cout<<num2<<" is the greatest number";
    }
    else if(num3>num1 && num3>num2){
        cout<<num3<<" is the greatest number";
    }
    else{
        cout<<"all numbers are equal";
    }
}