Here, we will find the largest number among three numbers using the logical AND (&&) operator and print the appropriate message on the console screen.
Logical AND (&&) operation:
In the case of logical AND operation, if both conditions are true then the result will be true otherwise result is considered false.
Program/Source Code:
The source code to demonstrate the logical AND (&&) operator is given below. The given program is compiled and executed successfully.
Output:
Explanation:
In the above program, we imported a package Swift to use the print() function using the below statement,
Here, we created three variables num1, num2, num3 that are initialized with 10, 50, 30 respectively. Then we compared variables and performed logical AND (&&) operation to find the largest number among three numbers and printed the appropriate message on the console screen.
need an explanation for this answer? contact us directly to get an explanation for this answer