Coder Social home page Coder Social logo

square-number-web-0916's Introduction

Square Number

Background

In mathematics, a square number or perfect square is an integer that is the square of an integer;[1] in other words, it is the product of some integer with itself. For example, 9 is a square number, since it can be written as 3 × 3.

Objectives

Write a method that, when given a square number, returns the integer that when squared, results in the given argument without using Ruby's built-in math methods, like sqrt(x).

This method should return false when given a number that is not a square number.

Examples

Remember that four times four equals sixteen. Therefore, when your method square_number? is called on sixteen, it should return four. Same with nine and eighty-one.

16.square_number?
# => 4

81.square_number?
# => 9

However, no whole number times itself equals 17 (four times four equals sixteen and five times five is twenty-five). Therefore, calling ``square_number?` on seventeen should return false.

17.square_number?
# => false

Note

Challenge yourself and avoid using Ruby's built-in math methods, such as sqrt(x).

Resources

View Square Number on Learn.co and start learning to code for free.

square-number-web-0916's People

Contributors

kthffmn avatar ahimmelstoss avatar fs-lms-test-bot avatar fislabstest avatar lshapz avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.