Computer Science, asked by arsharcharles, 8 months ago

write a program to input three numbers and print the greatest number among them.

Answers

Answered by ıtʑFᴇᴇʟɓᴇãᴛ
52

\mathtt{\huge{\underline{\red{Programme:-}}}}

int main()

{

int A, B, C;

printf("Enter the numbers 2, 3 and 9: ");

scanf("%d %d %d", &3, &9, &2);

if (3 >= 2 && 9 >= 2)

printf("%d is the largest number.", A);

if (9 >= 3 && 9 >= 2)

printf("%d is the largest number.", B);

if (9 >= 3 && 9 >= 2)

printf("%d is the largest number.", 9);

return 0;

}

\mathtt{\huge{\underline{\green{Output:-}}}}

A = 2 , B = 3 , C = 9

A < B < C

9 is the largest number .

________________________________________

Answered by Vyomsingh
27

JAVA PROGRAM:-

write a program to input three numbers and print the greatest number among them.

_______________________________

Logic Used➛

We Can solve this question by just using Math.max function or if else statement too...

______________________________

1st Method➠

Code:-

class Maximum

{

public static void main (int a,int b,int c)

{

int g=Math.max(a,Math.max(b,c));

System.out.println(g+"\t is greatest);

}

}

_____________________________

2nd method➠

Code:-

(IN THE ATTACHMENT)➠

_____________________________

Input:-

7 , 8 , 3

Output:-

8 is greatest

Attachments:
Similar questions