Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Paul Simon G.

Lim
Numerical Methods
DEV C++ CODE
#include <iostream>
#include <cmath>
using namespace std;
char y,b;
int main()
{
float a, b, c;

cout <<"\n";
cout << "Lim, Paul Simon G.";
cout << "\n\n";
cout << "CP 3 - Sample 1";
cout << "\n\n";
cout << "Title: Pythagorean Theorem";
cout << "\n\n";
a: cout <<"--------------------------------";
cout <<"\n";
cout << "Input side (a): ";
cin >> a;
cout << "\n\n";
cout << "Input side (b): ";
cin >> b;
cout << "\n\n";
float a2 = pow(a, 2);
float b2 = pow(b, 2);
c = sqrt(a2 + b2);
std::cout << "Computed Hypotenuse (h): " << c << std::endl;
do
{
cout << "\n\nWould you like to enter new values Y/N: " ;
cout << "\n";
cin >> y;
b=y;
if (y=='Y'||y=='y')
{
goto a;
}
if (b=='N'||b=='n')
{
break;
}
}
while (true);
return 0;
}
OUTPUT

You might also like