Find the greatest common divisor between two inputed integer

Assignment Help JAVA Programming
Reference no: EM13940973

I have to write an interactive program that will find the Greatest common divisor between two inputted integers.

Here is what i have so far.

//
//
//
// This Program will find the greatest common divisor between two inputted integers.
//
//

import java.io.*;

public class space11{

static BufferedReader keyboard =
new BufferedReader( new InputStreamReader(System.in));

public static void main(String args[]) throws IOException{

System.out.println();
System.out.println();

int divisor;
int small_number, larger_number;

System.out.println("This Program will fins the GCD between two numbers");
System.out.println();
System.out.print("Please enter the first number here: ");
first_number = Integer.parseInt(keyboard.readLine().trim());
System.out.println();
System.out.print("Please enter the second number here: ");
second_number = Integer.parseInt(keyboard.readLine().trim());
System.out.println();

for ( divisor = 2 ; divisor <= small_number; divisor++);
{

if ( small_number % divisor == 0 && larger_number % divisor ==0)

Reference no: EM13940973

Questions Cloud

Discuss the various logistical issues : Discuss the various logistical issues you would have to consider before commencing the import of products from the two new factories, taking into account the various procedures that need to be considered,
Search for organisations interested in its purchase : M J Morris is a prosperous unquoted company, whose owners are also the directors. The directors have decided to sell their business, and have begun a search for organisations interested in its purchase. They have asked for your assessment of the p..
Provide the journal entry for december : Prepare a bond amortization table assuming straight-line amortization. Provide the journal entry for December 31, 2010.
What is the expected value of earning a college degree : If the lifetime earnings of a high-school graduate average $1,200,000, what is the expected value of earning a college degree?
Find the greatest common divisor between two inputed integer : I have to write an interactive program that will find the Greatest common divisor between two inputted integers.
How much gasoline per year is being converted : How much money can be saved for 15,000 miles of driving per year and how much gasoline per year is being converted if one million people use the E20 fuel?
Preparing a complete statement of cash flows : Preparing a Complete Statement of Cash Flows. The following information is also available for 2008: Plant assets were sold for their book value of $180 during the year. The assets had an original cost of $290
What is a performance management system : 1. What is a performance management system? 2. List 5 of the strategic purposes an organization may have for their performance management system.
Did tyler make the most economical decision : Did Tyler make the most economical decision? What other options should Tyler have explored? In your answer, be sure to state your assumptions and quantify your thinking.

Reviews

Write a Review

JAVA Programming Questions & Answers

  Why is top down design beneficial

This and that is a powerful keyword used in Java. How is it used and why is it so beneficial? Give an example in your explanation.

  The program should ask the user to enter the student'' answer

Your program should store these correct answers in an array. (Store each question's correct answer in an element of a string array.) the program should ask the user to enter the student's answers for each of the 20 questions, which should be stored i..

  Design java program to enter name in input dialog box

Design the program called MailingLabel.java Program must ask user to enter name and address in input dialog box with each component of address seperated by comma.

  Write a java program to implement the finite field

Write a program called "GF2.java" to implement the finite field GF(p n ) where p is a prime number and n is a positive integer.  You also need to write four methods to realize "+", "-", "´", and "/".

  Design and implement a java version of the game memory

Design and implement a Java version of the game Memory

  Write an employee payroll program

Write an employee payroll program that uses polymorphism to calculate and print the weekly payroll for your company. There are three types of employees - hourly, salaried, and salaried plus commission. Each type of employee gets paid using a diffe..

  Write a program displaying a text file

Write a program displaying a text file that is in a text area - The user enters a file name in a text field and clicks the view button; the file is then displayed in the text area. Do not use BufferedInputStream.

  Provide java code for a method

Provide Java code for a method that would perform functionality of your choice. Try to create functionality that is unique - something that you could use. Be sure to include an example call to your method and explain the code you developed.

  Write a program that establishes two savings accounts

Write a program that establishes two savings accounts with saver1 having account number 10002 with an initial balance of $2,000, and saver2 having account 10003 with an initial balance of $3,000

  Write a java method delete(key1, key2) to delete

1. Write a Java method delete(key1, key2) to delete all records with keys between key1 and key2 (inclusive) from a binary search tree.

  Determine when the application should stop looping display

Write an application that reads a series of pairs of numbers as follows: 1) product number 2) quantity sold - Create an application in java

  The letters of the alphabet a through z

The letters of the alphabet A through Z can be represented in Morse code. Each letter is represented by a combination of up to four dots and/or dashes, as shown below. Use Java to write and run a console-window program that can convert an English ..

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd