PROGRAM - 1:
OUTPUT:
Value of 'a' greater than 10
Value of 'b' greater than 25
PROGRAM - 2:
OUTPUT:
package main
import "fmt"
func main() {
a := 10
if a < 10 {
fmt.Println("Value of 'a' less than 10")
} else {
fmt.Println("Value of 'a' greater than 10")
}
b := 30
if b > 50 {
fmt.Println("Value of 'b' greater than 50")
} else if b > 25 {
fmt.Println("Value of 'b' greater than 25")
} else {
fmt.Println("Value of 'b' less than 25")
}
}
OUTPUT:
Value of 'a' greater than 10
Value of 'b' greater than 25
PROGRAM - 2:
package main
import "fmt"
func main() {
// Adding statement before condition
if a := 10; a >= 5 {
fmt.Println("Value of 'a' greater than 5")
} else {
fmt.Println("Value of 'a' less than 5")
}
}
OUTPUT:
Value of 'a' greater than 5
No comments:
Post a Comment