Skip to content

Latest commit

 

History

History
59 lines (46 loc) · 1.04 KB

File metadata and controls

59 lines (46 loc) · 1.04 KB

Logical Operators

Objectives

  1. What is the output of the following code:
package main import"fmt"funcmain() { x:=2017result1:=x>50&&x<2020result2:=x>50&&x%2==0result3:=x%2==1&&x+3==2025fmt.Println(result1) fmt.Println(result2) fmt.Println(result3) x+=5result1=x>50&&x<3000result2=x>50&&x<3000result3=x>50&&x<3000fmt.Println(result1) fmt.Println(result2) fmt.Println(result3) }
  1. What is the output of the following code:
package main import"fmt"funcmain() { x:=2017result1:=x>50||x<2020result2:=x>50||x%2==0result3:=x%2==1||x+3==2025fmt.Println(result1) fmt.Println(result2) fmt.Println(result3) x+=5result1=x>50||x<3000result2=x>50||x<3000result3=x>50||x<3000fmt.Println(result1) fmt.Println(result2) fmt.Println(result3) }

Solution

Click here to view the solution

close