Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

Types of Triangles Based on Angles in c++

#include<iostream>
using namespace std;

int Triangle(int ang1, int ang2, int ang3);

int main()
{
	int ang1, ang2, ang3;

	cout << "Enter Angle 1: ";
	cin >> ang1;

	cout << "Enter Angle 2: ";
	cin >> ang2;

	cout << "Enter Angle 3: ";
	cin >> ang3;

	int sum = Triangle(ang1, ang2, ang3);

	//check
	if ((ang1 < 90 && ang2 < 90 && ang3 < 90) && (sum = 180))
		cout << "Acute Triangle." << endl;
	else if ((ang1 == 90 || ang2 == 90 || ang3 == 90) && (sum = 180))
		cout << "Right Triangle." << endl;
	else
		cout << "Obtuse Triangle." << endl;


	return 0;
}
//
int Triangle(int ang1, int ang2, int ang3)
{
	return (ang1 + ang2 + ang3);
}
Source by codejudge.blogspot.com #
 
PREVIOUS NEXT
Tagged: #Types #Triangles #Based #Angles
ADD COMMENT
Topic
Name
5+2 =