![]() ![]() ("Enter the length of leg1: ") // ask for length of leg1ĭouble leg1 = Float.parseFloat(user_input.next()) // get it from the keyboard and store as a double precision floatint point number ("Hi " name "! We will do some math now.") // say user's name String name = user_input.next() // get user's name Scanner user_input = new Scanner( System.in ) // user_input used for keyboard input ("Hello!\nEnter your name: ") // Command to print out text output the results with an appropriate label calculate the third side (use the Pythagorean theorem)Ĥ. ask the user for the two legs of a right triangle and read them inģ. ![]() Program greets you and outputs length of hypotenuse.Ģ. Purpose: compute the hypotenuse of a right triangle, given the lengths of the two legs. Program to find the third side of a right triangle.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |