Skip to content

Instantly share code, notes, and snippets.

@kenechiokolo
Created March 16, 2015 14:19
Show Gist options
  • Save kenechiokolo/1835af58095124f27b9d to your computer and use it in GitHub Desktop.
Save kenechiokolo/1835af58095124f27b9d to your computer and use it in GitHub Desktop.
CS106A: Assignment 2.4
/*
* File: PythagoreanTheorem.java
* Name:
* Section Leader:
* -----------------------------
* This file is the starter file for the PythagoreanTheorem problem.
*/
import acm.program.*;
public class PythagoreanTheorem extends ConsoleProgram {
public void run() {
println("Enter values to compute Pythagorean Theorem:");
int a = readInt("a:");
int b = readInt("b:");
double c = Math.sqrt(((double) a)*((double) a) + ((double) b) * ((double) b));
println("c = "+c+"");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment