Computer Science, asked by putch31441, 1 year ago

Write a script to take three numbers from the user and display the greatest number out of three

Answers

Answered by zoekar26
2

Answer:

I wrote it in C. Hope it helps

Explanation:

#include <stdio.h>

#include <stdlib.h>

main(){

int x,y,z, greatest;

scanf("%d", &x);

scanf("%d", &y);

scanf("%d", &z);

greatest = x;

if(gratest<y){

greatest = y;

}

else if (greatest < z){

greatest = z;

}

printf("The greatest number is %d", greatest);

system("pause");

}

Answered by Ankit02
1

You got in C. Now take in java.

class Greatest

{

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

{

if (a > b && a > c)

{

System.out.println(+a+" is largest.");

}

else if (b > a && b > c)

{

System.out.println(+b+" is largest.");

}

else if (c> a && c > b)

{

System.out.println(+c+" is largest.");

}

}

}

Hope it helps...

Similar questions