You are to write an assembly language program the 486 chip T
You are to write an assembly language program the 486 chip. The program will take three sides of a triangle and determine if the triangle is a right triangle or not. The three sides are read in at the keyboard (not hard coded in your program.)
Be able to use in either SASM or MASM.
Solution
Can You Try This;
/* This program inputs three positive integers a, b, and c and determines if there is a right triangle with side lengths a, b and c.
This will be true if and only if the square of one of the numbers is the sum of the squares of the other two */
#include
/* Complete the code for this program below */
int main (void)
{ int a;
int b;
int c;
int a2;
int b2;
int c2;
printf( \"Enter first side\ \" ); /* prompt */
scanf( \"%d\", &a ); /* read an integer */
printf( \"Enter second side\ \" ); /* prompt */
scanf( \"%d\", &b ); /* read an integer */
printf( \"Enter third side\ \" ); /* prompt */
scanf( \"%d\", &c ); /* read an integer */
a2 = a*a;
b2 = b*b;
c2 = c*c;
if (!((c2 == (a2 + b2)) ||
(b2 == (a2 + c2)) ||
(a2 == (b2 + c2))))
{
printf(\"The numbers are not the side lengths of a right triangle. \");
}
else{
printf(\"The numbers are the side lengths of a right triangle\ \");
}
return 0;
}
and This;
#include <iostream>
using namespace std;
int main(int argc, char**argv) {
int i = 1;
int j = 1;
int N = 8;
while (i <= N)
{
i = i++;
while(j <= i)
{
cout<<\"*\";
j = j++;
}
cout<<endl;
}
}
