google.com, pub-8786015629279405, DIRECT, f08c47fec0942fa0 Write a Program to Find Greatest Number of Three Number in Java

Write a Program to Find Greatest Number of Three Number in Java

0
Write a Program to Find Greatest Number of Three Number in Java.


//Write a Program to Find Greatest Number of Three Number in Java.

import java.io.*;


class greatest

{

public static void main(String args[])

{

int a,b,c;

a=13;

b=11;

c=12;


if (a>b)

{

if (a>c)

{

System.out.print(“A is greatest Number and the Value is =”+a);

}

else

{

System.out.print(“C is greatest Number and the Value is =”+c);

}

}
else

{

if(b>c)

{

System.out.print(“b is greatest Number and the Value is =”+b);

}

else

{

System.out.print(“A is greatest Number and the Value is =”+a);

}

}

}

}
Output:


A is greatest Number and the Value is =13


Using Scanner Class 


//Write a Program to Find Greatest Number of Three Number in Java.

import java.io.*;

import java.util.*;

class greatest

{

public static void main(String args[])

{

int a,b,c;


Scanner sr=new Scanner(System.in);

System.out.print(“Enter the value of First Number);

a=sr.nextInt();

System.out.print(“Enter the value of Second Number);

b=sr.nextInt();

System.out.print(“Enter the value of Third Number);

c=sr.nextInt();


if (a>b)

{

if (a>c)

{

System.out.print(“A is greatest Number and the Value is =”+a);

}

else

{

System.out.print(“C is greatest Number and the Value is =”+c);

}

}
else

{

if(b>c)

{

System.out.print(“b is greatest Number and the Value is =”+b);

}

else

{

System.out.print(“A is greatest Number and the Value is =”+a);

}

}

}

}
Output:


A is greatest Number and the Value is =13

Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.

Thank you for your interest 😊

We will back shortly after reviewing...

Thank you for your interest 😊

We will back shortly after reviewing...

Post a Comment (0)

#buttons=(Accept !) #days=(20)

Our website uses cookies to enhance your experience. Learn More
Accept !
To Top