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

  • Home
  • SEARCH
  • 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 8820797
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T05:41:51+00:00 2026-06-14T05:41:51+00:00

So I have been trying to tackle this problem for a while. Many things

  • 0

So I have been trying to tackle this problem for a while. Many things I have attempted have failed. Is there a way to add to what I already have?

for(int ii = 1, j = 0; j <= copySel ; ii++, j++) {    
             int check;
             int x, y;
                // Prompt as follows
                System.out.print("Enter value " + ii + ": ");
                try {
                    c = Get();
                }
                catch (InputMismatchException e) {
                    input
                    System.out.println("Invalid input!");
                    ii--;
                }check = c;   
                 x = check; // I want to try to copy this 
                 y = check - 1; // and copy this
                min(x , y) // trying to acheive this




                System.out.println(check + " " + x + " " + y);

        }

Sorry about the formatting. It is my screen.

Basically let us say user puts in 25 for first input. I want x = 25.
Then user inputs -11.                                 I want y = -11.
Compare minimum                                       z = -11.
then                                                  x = z = -11;
User input 33.                                        y = 33
annd so on..

So i ended up with something like

for(int ii = 1, j = 0; j <= copySel ; ii++, j++) {    
             int check;
             int x = 0, y = 0, z;
                // Prompt as follows
                System.out.print("Enter value " + ii + ": ");
                try {
                    c = Get();
                }
                catch (InputMismatchException e) {

                    System.out.println("Invalid input!");
                    ii--;
                }check = c;
               x = check;
               z = x;   
            if (j % 2 == 1)
            {
                y = check;
                Math.min(z, y);
            }


                System.out.println(check + " " + x + " " + y + " " + z);

        }
  • 1 1 Answer
  • 0 Views
  • 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-06-14T05:41:52+00:00Added an answer on June 14, 2026 at 5:41 am

    I guess you are trying to get the minimum value from the current input and last minimum value. Definitely it will be the minimum of all the numbers provided.
    Then all you need is to save minimum value from the last turn and compare it with input in the next one.

    for(int ii = 1, j = 0; j <= copySel ; ii++, j++) {  //btw, what is 'j' for? attempt count?
             boolean mode; //true = minimum, false = maximum
             boolean firstNumber = true;
             int check; //user input
             int lastValue; //will be the storage
                // Prompt as follows
                System.out.print("Enter value " + ii + ": ");
                try {
                    c = Get();
                }
                catch (InputMismatchException e) {
                    input
                    System.out.println("Invalid input!");
                    ii--;
                }
                 check = c;
                 if (firstNumber) { //first input has nothing to compare with
                     lastValue = check;
                     firstNumber = false;
                     continue;
                 }
                 lastValue = mode ? min(check, lastValue) : max(check, lastValue);
                 /* you should also implement max() method if you want to be able to find maximum
                 *  if you don't, just write lastValue = min(check, lastValue);
                 *  and remove other 'mode' dependancies.
                 */
    
    
                 System.out.println((mode ? "minimum is: " : "maximum is: ") + String.valueOf(lastValue));
    
        }
    

    hope I have understood your problem correct.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this problem I've been trying to tackle for a while. I have
I have been trying to solve this problem for a while, could not find
I have a problem. I've been trying to tackle it for a while now
I have been trying to tackle this problem , but I am having difficulty
Have been trying to fix this problem I have here. Basically I have a
I have been trying to get this working for a while now and am
I have a problem that I have been trying to tackle for the last
I'm trying to figure out what the best way to tackle this would be.
I've been trying to figure this out for a couple days now. I have
I have been trying to use FactoryGirl while developing a Rails 3 mountable engine,

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.