Tech Study

Write a Swift program that accept 2 integer values and return true if one of them is 30 or if their sum is 30

Introduction

I have used Swift for windows 1.9 for debugging purpose. But you can use any Swift programming language compiler as per your availability.

func findandtotaltwenty(num1: Int, num2: Int) -> Bool {
    if num1 + num2 == 30 || num1 == 30 || num2 == 30
 
    {
        return true
    }
    else
    {
        return false
    }
}
print(findandtotaltwenty(num1: 10, num2: 30))
print(findandtotaltwenty(num1: 15, num2: 15))
print(findandtotaltwenty(num1: 39, num2: 15))

Result

Java Final keyword

Introduction : java final keyword The final keyword present in Java programming language is generally used for restricting the user. …

Read more

C++ Memory Management: new and delete

C++ Memory Management We know that arrays store contiguous and the same type of memory blocks, so memory is allocated …

Read more