Skip to main content

Posts

Showing posts from March, 2021

Coding Problem: Series Based

Coding question based on series are usually asked in coding section of various coding tests.   Find the nth term of the series: 0,0,7,6,14,12,21,18, 28_ _ _ _ Find the nth term of the series:  1 , 1 , 2 , 3 , 4 , 9 , 8 , 27 , 16 , 81 , 32 , 243 ,_ _ _ _   Find the nth term of the series:  0, 0, 2, 1, 4, 2, 6, 3, 8, 4, 10, 5, 12, 6, 14, 7, 16, 8

Coding Problem: Fibonacci Series

Problems based on Fibonacci Series: 0, 1, 1, 2, 3, 5, 8, 13, 21 ,34, 55, 89, 144 ......... First=0 Second=1 Third= 0+1= 1 Sum of Previous 2 values Fourth= 1+1= 2 Fifth= 1+2= 3 Sixth= 2+3= 5 And so on..... Print the Nth term of the fibonacci series: Print N terms of fibonacci series:

Coding Problem: Area of Circle

 Write a program to print the area of a circle of given radius ' r ' up to 2 decimal places. Code: Output:

Coding Problem: Oddly Even

Find the difference between the sum of odd and even position digits Example: Input 1234 Output 2 Explanation: sum of values at odd position: 1+3=4 sum of values at even position: 2+4=6          6-4=2 Code:

Coding Problem: Check for Leap Year

 Given a number N, the task is to check if N is a Leap Year or not. A leap year is exactly divisible by 4 except for century years (years ending with 00). The century year is a leap year only if it is perfectly divisible by 400. Code:

Coding Problem: Based on Caesar Cypher

This a coding problem based on Caesar Cypher(or Cipher). Caesar Cipher Technique is a simple and easy method of encryption. It is a simple type of substitution cipher in which each letter of plain text is replaced by a letter with some fixed number of positions down with alphabet. This is used in a way: Given: a=z  b=y ............ z=a For example: Input: abc Output should Be:  zyx Code:

Coding Problem: Sober Walk

Our hoary culture had several great persons since time immemorial and king vikramaditya’s nava ratnas(nine gems) belongs to this ilk. They are named in the following shloka: Among these, Varahamihira was an astrologer of eminence and his book Brihat Jataak is recokened as the ultimate authority in astrology. He was once talking with Amarasimha,another gem among the nava ratnas and the author of Sanskrit thesaurus, Amarakosha. Amarasimha wanted to know the final position of a person, who starts from the origin 0 0 and travels per following scheme.     He first turns and travels 10 units of distance     His second turn is upward for 20 units     Third turn is to the left for 30 units     Fourth turn is the downward for 40 units     Fifth turn is to the right(again) for 50 units … And thus he travels, every time increasing the travel distance by 10 units. Code: