Java 1.4: sequence

sequence

import java.util.Scanner;

public class Main {

    static double [] sequence = {0,0,0};

    public static void main(String[] args) {

        Scanner scan = new Scanner(System.in);

        System.out.println("Enter first double: ");
        sequence[0] = scan.nextDouble();

        System.out.println("Enter second double: ");
        sequence[1] = scan.nextDouble();

        sequence[2] = sequence[1] * (sequence[1] / sequence[0]);

        System.out.println("The third double is therefore " + sequence[2]);
    }
}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s