Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6059591
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:43:42+00:00 2026-05-23T08:43:42+00:00

I have the following problem: There is an array that consists of 6 numbers,

  • 0

I have the following problem:

  1. There is an array that consists of 6 numbers, each two digits at maximum.
  2. Y is an array whose i th element is the sum of the first i +1 elements of the first array.
  3. Accept a numerical input via keyboard. If it matches one of the numbers in Y display a message; If not, restart the program.

Diagram

This is the algorithm that I am thinking:

  • Initialize empty array [x] & [y]
  • 6.times.map{ Random.rand(1..99) }
  • Add numbers using each do?
  • Store in array [y ]
  • Compare input to == array [y]
  • If any instance matches display msg else restart

I would be really grateful for any guidance or help with this problem.

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T08:43:43+00:00Added an answer on May 23, 2026 at 8:43 am
    loop do
      x = Array.new(6){rand(99)}
      y = []
      x.each{|k| y.push(k + y.last.to_i)}
      y.shift
      break if y.include?(gets.to_i)
    end
    puts 'message'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Avast there fellow programmers! I have the following problem: I have two rectangles overlapping
I have the following problem. I have an array of bytes that I want
Propose to consider the following problem. Suppose we have some composite object. Are there
Simplified, I have to solve the following problem: You have a 2-dimensional array filled
I have the following homework problem: Given an array of scores, return true if
I have following classes: Container , Element and then couple of classes that inherit
Hey there, I have a probably straight-forward question about the following problem: I have
I have the following problem: I have this multi-level array (nested array) which contains
here is my problem I have the following array (for example) string[] arr =
Good morning SO, I have a class that contains the following static array: public

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.