Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ROWS 9
- // COLUMNS 9
- import java.util.*;
- import java.text.*;
- public class Proj3 {
- public static void main(String[] args) {
- Scanner input = new Scanner(System.in);
- System.out.print("Enter x1: ");
- double x1 = input.nextInt();
- System.out.print("Enter y1: ");
- double y1 = input.nextInt();
- System.out.print("Enter x2: ");
- double x2 = input.nextInt();
- System.out.print("Enter y2: ");
- double y2 = input.nextInt();
- double slope = (y2-y1) / (x2-x1);
- double intercept = y1-slope*x1;
- System.out.printf("y = " + "%.2f" + "x" + " + " + "%.2f\n", slope,intercept );
- System.out.println();
- int i;
- int j;
- for (i=9; i>=0; i--) {
- for (j=13; j>=0; j--) {
- if (j==i+4) {
- System.out.print(j-4);
- }
- }
- System.out.println();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement