__ Problem:-__

You are provided an array of size that contains non-negative integers. Your task is to determine whether the number that is formed by selecting the last digit of all the N numbers is divisible by .

Note: View the sample explanation section for more clarification.

Input format

- First line: A single integer denoting the size of array
- Second line: space-separated integers.

Output format

If the number is divisible by , then print . Otherwise, print .

Constraints

Last digit of is .

Last digit of is .

Last digit of is .

Last digit of is .

Last digit of is .

Therefore the number formed is which is not divisible by .

__Code:-__

Here I am going to give you two solution first one is on the basis of C language and second one is on the basis of c++ language which you can submit in c++14 and c++17 also

__Solution 1 ( C language):-__

__Solution 2 ( C++ language):-__

In this solution first three lines of the main function is only for the decreasing the time of execution of the program..

This is your choice that you want to use this or not but in some cases the code may take more time in execution and that time we need it .

__Recommended Post:-__

- Very Cool numbers | Hacker earth solution
- Birthday party | Hacker earth solution
- Most frequent | hacker earth problem solution
- program to find symetric difference of two sets
- cost of balloons | Hacker earth problem solution
- Chacha o chacha | hacker earth problem solution
- jadu and dna | hacker earth solution
- Bricks game | hacker earth problem
- Anti-Palindrome strings | hacker earth solution
- connected components in the graph | hacker earth data structure
- odd one out || hacker earth problem solution
- Program to find cycle in the graph
- Implementation of singly link list
- Implementation of queue by using link list
- Algorithm of quick sort
- stack by using link list
- program to find preorder post order and inorder of the binary search tree
- How to set limit in the floating value in python
- What is boolean data type
- How to print any character without using format specifier

## 1 Comments

I loved the solution.

ReplyDeleteProbably most of us were trying to build a number with the last digit of the inputs.

But only dividing the last number, since the last digit must be zero in order to get 0 as the remainder.

Awesome, solution.

I really appreciate it.'