Giter VIP home page Giter VIP logo

golang-cohort-mini-challenge-1's Introduction

SquareCube Challenge

Challenge Description

  • Task: Write a loop that iterates from 1 to n, where n is a dynamically provided input, not hardcoded.
  • Conditions:
    • If a number is a perfect square, print "Square".
    • If a number is a perfect cube, print "Cube".
    • If a number is both a perfect square and a perfect cube, print "SquareCube".
    • Otherwise, print the number itself.

Input

  • n (integer): The maximum number for the loop iteration. The value of n is dynamic.

Output

  • The output should be either "Square", "Cube", "SquareCube", or the number itself based on the conditions described above.

Notes

  • Perfect Square: A number is considered a perfect square if it can be expressed as the square of an integer. For example, 16 is a perfect square because it is 4².
  • Perfect Cube: A number is a perfect cube if it can be expressed as the cube of an integer. For example, 27 is a perfect cube because it is 3³.

Example

For n = 10, the expected output would be:

SquareCube
2
3
Square
5
6
7
Cube
Square
10

golang-cohort-mini-challenge-1's People

Contributors

martjellino avatar

Watchers

 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.