ابدأ بالتواصل مع الأشخاص وتبادل معارفك المهنية

أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.

متابعة

Task 3 Write a program that calculates the length of the hypotenuse of a right triangle with the Pythagorean Theorem.

user-image
تم إضافة السؤال من قبل Tomasz Modrzejewski , Python Developer , Freelancer
تاريخ النشر: 2014/08/24
Tomasz Modrzejewski
من قبل Tomasz Modrzejewski , Python Developer , Freelancer

answer Pythagoras program; var   a, b: real; begin   write ('Enter the length of the hypotenuse:');   readln (a, b);   writeln ('The length of the hypotenuse c =', sqrt (a * a + b * b));   readln; end.

هاشم المشارقة
من قبل هاشم المشارقة , Key Account Manager , Advanced United Systems Ltd. ( A member of Taj Holding Group)

I will write a very simple program using C++ language.

------------------------------------------------------------

#include <iostream.h>

void main(){

float a, b;

cin >> a;

cin >> b;

cout << "the hypotenuse equal to: " << sqrt(a*a+b*b);

}

Shagufta Mubasher
من قبل Shagufta Mubasher , Web Developer , MP CJ O Shopping Sdn. Bhd.

Using Java

--------------------------------------------------------------------

package com.java2novice.math;

 

public class MyHypotEx {

 

    public static void main(String[] args) {

         

        int x =10;

        int y =20;

        System.out.println("The length of hypotenuse is: "+Math.hypot(x, y));

    }

}

مستخدم محذوف‎
من قبل مستخدم محذوف‎

... Void main (){ float a, b; cout <<" Enter the length of hypotenuse : " ; cin>> a; cin>> b; cout <<"the length is : "<

Wolf Klaas Kinsbergen
من قبل Wolf Klaas Kinsbergen , Managing Director, Designer , ingenieursbureau KB International NV

Use excel, using  hyp C^2= length A^2 + width B^2, you can fill it in for every Length and Width.

Abdulelah Fallatah
من قبل Abdulelah Fallatah , Tech-Support Specialist & Programmer , Al-Rayan Colleges

I'll use plain English to write the algorithm ;) :

 

- Get the input of the first line and store it in a variable called "line1".

- Get the input of the second line and store it in a variable called "line2".

- Get the sum of "line1" and "line2" and store it in a variable called "hypotenuse_squared".

- Take the square root of "hypotenuse_squared" and, after that, display it to the user as output.

sheik abdullah
من قبل sheik abdullah , CNC PROGRAMMER/SETTER-CNC lathe-VMC,HMC , shall engineering

simple....

 

 

L ABC is a triangle  where  B is90 degree , and  AC is hypo. 

 

so     AC(hypo) = (BC square +AB square)

 

 

Gayasuddin Mohammed
من قبل Gayasuddin Mohammed , Advocate , Practicing Law before High Court at Hyderabad

Assume ABC is a Right Angled Triangle, Angle B is90 degrees. AC is your Hypotenuse,  AB is your opposite side and BC is your Adjacent side.

Pythagorean theorem is  (hyp)^2 = (opp.side)^2 + (adj.side)^2

 

#include <stdio.h>

#include<math.h>

main()

{

float oppSide,adjSide,hypotenuse;

scanf("Enter value of the opposite side =%f ", &oppSide);

scanf("Enter value of the Adjacent side =%f", &adjSide);

 

hypotenuse = sqrt( ((oppSide)* (oppSide)) +((adjSide)*(adjSide)) );

 

printf(" hypotenuse of the given other sides of right angled triangle is :%f", hypotenuse );

 

}

المزيد من الأسئلة المماثلة