Giter Site home page Giter Site logo

integer-chapter's Introduction

Ruby Practice

Run your Ruby file by typing ruby and then the name of the file you want to run in the Terminal.

If we want to run integer_math.rb, we can write the command:

ruby integer_math.rb

To re-run this command, you can use the UP and DOWN arrow keys to look at the history of commands you've run in a Terminal.

Integer

integer_math.rb

If you divide the number of days in a regular year by the number of days in a week, what's the remainder?

Your output should be a number; for example,

4

integer_odd.rb

It should ask the user to enter a number (using gets) and output true or false if the entered number is odd.

Example (13 is the input):

"Enter an odd number:"
13
true

Example (12 is the input):

"Enter an odd number:"
12
false

integer_birth_year.rb

Ask for a person’s age, and then calculate and display what year they were born in.

Input: 80

Key output: "Wow, you were born in 1940. You're old!"

Complete input and output example:

"How old are you?"
80
"Wow, you were born in 1940. You're old!"

Specs

Click here to see names of each test

integer_math.rb should output '1'

integer_odd.rb should output 'true' if the entered number is odd

integer_odd.rb should output 'false' if the entered number is not odd

integer_birth_year.rb should output 'Wow, you were born in 1940. You're old!' if the input is 80.

integer-chapter's People

Contributors

raghubetina avatar osha7 avatar jelaniwoods avatar pmckernin 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.