# Category: MISC

## Check whether the given number is a perfect square

Objec­tive:  Given an inte­ger check whether it is a per­fect square. Exam­ple: num­ber = 37 Out­put: false num­ber = 49 Out­put: true This is fun puz­zle which is asked in the inter­view. Approach: Say number…

## Find remainder without using modulo operator

Objec­tive:  Write Given two inte­gers ‘num­ber’ and ‘divi­sor’, Write an algo­rithm to find the remain­der if ‘num­ber’ is divided by ‘divi­sor’. Con­di­tion: You are not allowed to use mod­ulo or % oper­a­tor. Exam­ple: num =…

## Swap two numbers without using extra variable

Objec­tive:  Write an algo­rithm to swap two num­bers with­out using extra vari­able. This is fun puz­zle which is asked in the inter­view. Approach: Exam­ple: a = 3, b = 5 a = a + b…

## Print All the Subsets of a Given Set (Power Set)

Objec­tive: Given a set of num­bers, print all the poss­si­ble sub­sets of it includ­ing empty set. Power Set: In math­e­mat­ics, Pow­er­Set of any given set S, PS(S) is set of all sub­sets of S including…

## Convert Decimal into Irreducible Fraction

Objec­tive: Given a dec­i­mal num­ber, con­vert it into irre­ducible frac­tion. Irre­ducible Frac­tion : An irre­ducible frac­tion is a frac­tion in which the numer­a­tor and denom­i­na­tor are inte­gers that have no other com­mon divi­sors than…

## Clock Angle Problem

Objec­tive: Find the Angle between hour hand and minute hand at the given time. Exam­ple: Time : 12:45 Input : hour = 12, Minute = 45 Out­put : 112.5 Time : 3:30 Input : hour…