Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Untitled

a guest Jul 13th, 2018 53 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. import java.util.Scanner;
  2. public class Necklace {
  3.  
  4.     /**
  5.      * @author christopher quijano
  6.      * date:    3 21 12
  7.      * @param args
  8.      */
  9.     public static void main(String[] args) {
  10.         //variables
  11.         Scanner input = new Scanner(System.in);
  12.         int first,second;
  13.         int t1,t2;
  14.         boolean done;
  15.        
  16.         //prompt user for input
  17.         System.out.print("Enter first starting number : ");
  18.         first = input.nextInt();
  19.         System.out.print("Enter second starting number : ");
  20.         second = input.nextInt();
  21.        
  22.         //formulae for finding sum of numbers and displaying the numbers
  23.         t1 = (first + second)%10;
  24.         t2 = (second + t1)%10;
  25.         System.out.print( first + " " + second + " " + t1 + " " + t2);
  26.         done = (first == t1) && (second == t2);
  27.        
  28.         //output
  29.         while (!done)
  30.         {
  31.         t1 = (t1 + t2)%10;
  32.         t2 = (t2 + t1)%10;
  33.         System.out.print(" " + t1 + " " + t2);
  34.         done = (first == t1) && (second == t2);
  35.         }
  36.        
  37.        
  38.        
  39.     }
  40.  
  41. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top