Thursday, 23 April 2015

nextPerfectSquare that returns the first perfect square that is greater than its integer argument

Write a function named nextPerfectSquare that returns the first perfect square that is greater than its integer argument. A perfect square is an integer that is equal to some integer squared. For example 16 is a perfect square because 16 = 4 * 4. However 15 is not a perfect square because there is no integer n such that 15 = n*n.

The signature of the function is

 int nextPerfectSquare(int n)

Examples



Answer Coming Soon. You can also Guess in comments.

Simple Programming Test

This site will contain collection of programming test questions and answers from different examinations. This will help prepare for examinations. Mostly the questions will be about loops, strings and numeric problems.

Questions will also be published separately, so that anyone can try without looking at answers first. Readers can also comment better answers. Answers can simple be converted to different programming language such as C or C# from Java.

These content can be helpful for preparing for Programming Test for entry at University like MUM (Maharishi University of Management) Msc CS (Computer Science) Course.

Comment is open to all.