Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Rextester.java
import java.util.Scanner; class Rextester { String numDiologueLn; public static void promptEnterKey() { Scanner scanner = new Scanner(System.in); scanner.nextLine(); } public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.print("Hey... buddy :)))"); promptEnterKey(); System.out.println("How's it hangin', my doood??"); promptEnterKey(); System.out.print("Bet chu I can find the GCF of two integers faster than you!!"); promptEnterKey(); System.out.println("yo"); promptEnterKey(); System.out.println("Please.. Broski, type the first positive integer, then hit enter."); int a = input.nextInt(); if (a<=0) { System.out.println("\nD:"); try { Thread.sleep(2000); } catch (InterruptedException e) { e.printStackTrace(); } System.out.print("Try again, big man, but this time do it like I told you!!"); return; } System.out.println("\nPlease type the second positive integer, then hit enter, my doood."); int b = input.nextInt(); if (b<=0) { System.out.println("\nD:"); try { Thread.sleep(2000); } catch (InterruptedException e) { e.printStackTrace(); } System.out.print("Try again, big man, but this time do it like I told you!!"); return; } System.out.println("\nHOMIE!!!..."); int gcf; if (a==b) { gcf = a; System.out.println("The GCF is " + gcf + "!!!!!!!!"); } while(b!=0){ if (a > b) { int remainder = a % b; a = b; b = remainder; } else { int temp = a; a = b; b = temp; } } if (a != 1) { gcf = a; System.out.println("The GCF is " + gcf + "!!!!!!!!"); } else { System.out.println("The two numbers are relatively prime!"); } } }
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
// Java Coding Challenge - 07: Print out Fibonacci number 0 - 1000
1.6
PE #12
Reverse string template
moneda
4.C
OBF-7 4
Strings Ops
test1
cosmology
Please log in to post a comment.