Tech Study

Write a Swift program to test whether the last digit of the two given integer values are same or not

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 same_last_Digit(_ a: Int, _ b: Int) -> Bool {
    guard a < 0, b < 0 
    else 
     {
        if a % 10 == b % 10 
        {
            return true
        }
        else
        {
            return false
        }
    }
    return false
 
}
print(same_last_Digit(18, 22))
print(same_last_Digit(5, 15))
print(same_last_Digit(25, 5))

Result

Write a Swift program to test whether the last digit of the two given integer values are same or not
Write a Swift program to test whether the last digit of the two given integer values are same or not

TaggedWrite a Swift program to test whether the last digit of the two given integer values are same or not

C String Functions

C String Functions perform certain operations, It provides many useful string functions which can come into action. The <string.h> header …

Read more

Function Pointer in C++

Introduction : Function Pointer in C++ Pointers: In function pointer in c++ are the variables that consist of addresses of …

Read more