Thursday, March 7, 2019

Zoho Coding Questions

Step Number:-
Given a number N, the program must print if N is a step number or not. (A step number is a number which
has a digit which is either 1 more or 1 less than the previous digit).
Input Format:
The first line contains N.
Output Format:
The first line contains yes or no
Boundary Conditions:
10 <= N <= 99999999
Example lnput/Output 1:
Input:
1212343
Output:
yes
Example lnput/Output 2:



Input:
342345
Output:
no
Explanation:
The difference between 2 and 4 is NOT 1






















Array LEADERS (2H)
An array of N numbers is passed as input. The program must print all the LEADERS in the array.A number is a LEADER if it is greater than all the numbers to it's right.
Note: The rightmost number is always a leader.
Input Format:
The first line contains N numbers. each separated by a space.
Output Format:
The first line contains the LEADERS, each separated by a space.
Boundary Conditions:
1 <= N <= 9999
Example lnput/Output 1:
Input:
10 17 4 3 5 2
Output:
17 5 2





















Print 1to N - Digits Count [ZOHO]
A positive integer N is passed as the input. If we print all the numbers from 1 to N continuosly, the program must find the number of characters(dig1‘ts) C printed and print the count C as the output-
Input Format:
The first line contains N.
Output Format:
The first line contains C.
Boundary Conditions:
1 <= N <= 9999999
Example Input/Output 1:
Input:
2
Output:
2
Explanation:
We print 12 and hence the total number of characters is 2.
Example lnput/Output 2:
Input:
15


















Pattern Printing ~ Numbers [ZOHO]
Based on the input value of N. the program must print the pattern described below.
Input Format:
First line will contain the value of N-
Output Format:
N lines will contain the number pattern as described below with each value separated by a single space.
Boundary Conditions:
1 <= N <= 50
Example lnput/Output 1:
Input:
5
Output:
1 6 10 13 15
2 7 11 14
3 8 12
4 9
5

















String- ReverseWords [ZOHO]
A strings is passed as the input. The program must reverse the order of the words in the string and print them as the output.
Input Format:
The first line will contain 5.
Output Format:
The first line will contain the words in the strings in the reverse order.
Boundary Conditions:
Length of S is from 5 to 100.
Example lnput/Output 1:
Input:
Today is Friday
Output:
Friday is Today
Example lnput/Output 2:
Input:
five six ten eleven
Output:
eleven ten six five

Saturday, October 13, 2018

C Easy Solutions


Fisherman's Mantra:-

Input Format:
A
fisherman usually gets F number of fish from the sea. The fisherman requested a sage to yield more fishes from the sea. So he got a special boon from the sage. The sage allowed him to chant a mantra for N times. For each time he chants the mantra, the number of fish captured doubles. Given the number of first day fish F and number of times N he chants the mantra, find the final increased count of fish he gets from the sea.
The first line contains the value of fishes F and number of chants N separated by a space.
Output Format
The first line contains the value of final number of fish T
Example Input/Output 1: 
Input:
5 2
Output: 20
Example Input/Output 2: 
Input:

6 1

Output: 12


Arithmetic Progression:-


Accept three values related to an arithmetic progression - number of terms T. initial value I and the difference between the terms D. Print the values of the T terms.
Input Format :
The first line contains the number of terms T.
The second line contains the initial value I.
The third line contains the difference between the terms D.
Output Format :
The first line contains the values of T terms in the progression.
Example Input/Output 1:
Input:
5
1
Output:

1 3 5 7 9
Example Input/Output 2:
Input:
6 5 20
Output:
5 25 45 65 85 105


Pattern-001:-
Given the number of rows N. print the numbers from 1 to N'N . such that N elements are printed in each row.
Input Format :
The first line contains the number of rows N.
Output Format :
First N• N numberssuch that each row contains N numbers.
Example Input/Output 1:
Input:
3
Output:
1 2 3
4 5 6
7 8 9
Example Input/Output 2: Input:
6

Output:
1 2 3 4 5 6
7 8 9 10 11 12
13 14 15 16 17 18
19 20 21 22 23 24
25 26 27 28 29 30
31 32 33 34 35 36


Zoho Coding Questions

Step Number:- Given a number N, the program must print if N is a step number or not. (A step number is a number which has a digit which is ...