FastFoodCoding

Connect with one of the following accounts

Please wait while we redirect...

Views: 107

Following program shows you how to find largest number from given 3 numbers.
In this program we get inputs from user and shows largest number from given three numbers using `if condition`

``````package main

import "fmt"

func main() {

var input1 int
var input2 int
var input3 int
fmt.Println("Enter first number:")
fmt.Scanf("%d", &input1)
fmt.Println("Enter second number:")
fmt.Scanf("%d", &input2)
fmt.Println("Enter third number:")
fmt.Scanf("%d", &input3)
if ((input1 == input2) && (input1 == input3)) {
fmt.Println("All numbers are equal")
} else if ((input1 > input2) && (input1 > input3)) {
fmt.Println(input1 , " is larger than " , input2 , " and " , input3)
} else if ((input2 > input1) && (input2 > input3)) {
fmt.Println(input2 , " is larger than " , input1 , " and " , input3)
} else if ((input3 > input1) && (input3 > input2)) {
fmt.Println(input3 , " is  larger than " , input2 , " and " , input1)
}
}
``````

### Output:

Example1:

``````Enter first number:
12
Enter second number:
12
Enter third number:
12
All numbers are equal
``````

Example2:

``````Enter first number:
25
Enter second number:
15
Enter third number:
12
25  is larger than  15  and  12
``````

On By