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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T14:49:18+00:00 2026-06-17T14:49:18+00:00

i have a question in my textbook that says: Write a method multiple that

  • 0

i have a question in my textbook that says:

Write a method multiple that takes two integers as its arguments and returns true if the first integer is divisible
evenly by the second one (i.e., there is no remainder after division); otherwise, the method should
return false. Incorporate this method into an application that enables the user to enter values to test the
method.

and i wrote this code but its not working:

public class project1 {

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int a, b;
        System.out.println("enter the first number");
        a = input.nextInt();

        System.out.println("enter the first number");
        b = input.nextInt();
    }

    public static boolean multiple(int g, int c) {

        int g, c;

        if (g % c = 0) {
            return true;
        } else {
            return false;

        };
    }
}
  • 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-17T14:49:19+00:00Added an answer on June 17, 2026 at 2:49 pm

    First of all you don’t need to declare g and c again in the function multiple (It is an error). Second, you didn’t call the function at all, you just implemented it. And like other people answered, you need to have == instead of =.

    public static void main(String[] args) {
        Scanner input = new Scanner (System.in);
        int a,b;
        System.out.println("enter the first number");
        a=input.nextInt(); 
    
        System.out.println("enter the first number");
        b=input.nextInt();
    
        boolean result = multiple(a,b);
        System.out.println(result);
    }
    
    public static boolean multiple (int g,int c){
        if (g%c==0){
            return true;
        }
        else
        {
            return false;
        }
    }
    

    Note that you can have a shorter version of multiple which have only one line: return g%c==0;

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

Sidebar

Related Questions

I have question about XSLT1.0. The task is to write out in HTML all
I have Question and QuestionTypes. In Question table there is a foreign key that
I have this question in my text book: Suppose that we have a set
A textbook I have notes that you can provide your own implementation for standard
I have been learning Assembly and I have a question. The textbook presents the
I have question that seems simple to you all but can't really get it.
Embarrassingly newbie question: I have a string field in my model that contains line
I have data from a survey. It comes from a question that looks like
I have question about parsing in Html helper : I have sth like: @foreach
I have question. I have some app on facebook and getting this error Fatal

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.