Cognizant GenC Elevate Sample Coding Question 4

Question 4

In this article, we will discuss about Coding Question with their solution in C++, java and Python. This is the Basic Mathematics based question in which we have to find the remainder when number n is divided by 11.

 

reverse a linked list without changing links

Question 4

Given a number n, the task is to find the remainder when n is divided by 11. The input number may be very large.

Since the given number can be very large, you can not use n % 11.

Input Specification:
inputs a large number in the form of a string

Output Specification:
Return the remainder modulo 11 of input1

Example1:
Input : str = 13589234356546756
Output : 6

Example2:
Input : str = 3435346456547566345436457867978
Output : 4

Example3:
input: str = 121
Output: 0