Swift Program to Demonstrate the Logical and (&&) Operator

Swift program to demonstrate the logical AND (&&) operator

// Swift program to demonstrate the 
// logical AND "&&" operator

import Swift;

var num1=10;
var num2=50;
var num3=30;

if(num1 > num2 && num1 > num3)
{
    print("Num1 is largest number");
}
else if(num2 > num1 && num2 > num3)
{
    print("Num2 is largest number");
}
else
{
    print("Num3 is largest number");
}

Output

Num2 is largest number

...Program finished with exit code 0
Press ENTER to exit console.

Ranjith

Hi, I'm Manoj a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coding Diksha. Here, I post about programming to help developers.

Leave a Reply