Print sequence of numbers without using loop

Question: Microsoft: Print a sequence of numbers starting with N, without using loop, in which  A[i+1] = A[i] – 5,  if  A[i]>0, else A[i+1]=A[i] + 5  repeat it until A[i]=N. Input: The first line contains an integer T, number of test cases. Then following T lines contains an integer N. Output: For each test case, print the pattern in newline with […]

To check whether the given number is mono-digit or not

Question: Write a program to check the number is mono-digit or not. Conditions: The programmer is allowed to add and subtract the consecutive digits (starting from left). And you are allowed to do only one operation on a digit. You cannot perform any operation on a resultant digit of the previous operation. Your code should […]