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 4265326
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T06:36:32+00:00 2026-05-21T06:36:32+00:00

This is my first problem: gcd(x,y) if (x < y) gcd(y,x) else if (y

  • 0

This is my first problem:

gcd(x,y)
  if (x < y)
    gcd(y,x)
  else
    if (y = 0)
      return x
    else
      return gcd(y, x mod y)

This is my second problem:

public static int Test2(int x, int y) {
  if (x > y) {
    return 10;
  } else {
    return Test2(x-5, y+5) + 5;
  }
}

The question is: What is returned for gcd(84, 21)?

  • a. 84
  • b. 21
  • c. 3 (This is the correct answer)
  • d. 10

X equals 84 and y equals 21. So I run them through the Algorithm class. 84 is not less than 21 so I skip that if statement. 84 is not equal so I skip that statement. I go to return gcd(y, x mod y). I don’t understand what is mod and how do you figure out what it means?

Second problem!
Question: What is returned for Test2(18,5)?

  • A. 5
  • B. 10
    I choose ten , because x is greater than y and when processed to the if statement. It returns a value of ten. The if statements does run anything but the return statement.
  • C. 15 The answer is 15.
  • D. 20
  • 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-05-21T06:36:33+00:00Added an answer on May 21, 2026 at 6:36 am

    mod is the modulo function. It’s the rest when when you divide two integers. For example,

    1 mod 3 = 1
    2 mod 3 = 2
    3 mod 3 = 0
    4 mod 3 = 1
    10 mod 4 = 2
    

    10 is the correct answer for the second question, your argument is correct.

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

Sidebar

Related Questions

UPDATE: First problem solved, second one described at the bottom of this post. UPDATE2:
First of all: This question is not directly programming related. However, the problem only
I have a problem similar to the first problem in this question , which
I had a different problem first, so I made this post: Java JPanel mouse
This is my first post here. I have a problem. I need to take
This is my homework, but please read my problem description first. I have to
This is a strange problem.I init sem and destory it first,then i init it
well this is my problem i use 2 source first query (select * from
Making my first steps in RIA Services (VS2010Beta2) and i encountered this problem: created
I have a problem with this script. At first I had the <div> s

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.