Quantcast

A community for students. Sign up today!

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

bunyonb

  • one year ago

2. Write a program which, given three values representing the sides of a triangle prints: * 0 if the values cannot be the sides of any triangle. This is so if any value is negative or zero, or if any length is greater than the sum of the other two. * 1 If the triangle is equilateral. * 2 If the triangle is isosceles * 3 if the triangle is scalene.

  • This Question is Closed
  1. bunyonb
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    HERE IS MY CODE SO FAR: /*Write a program which, given three values representing the sides of a triangle prints: * 0 if the values cannot be the sides of any triangle. This is so if any value is negative or zero, or if any length is greater than the sum of the other two. * 1 If the triangle is equilateral. * 2 If the triangle is isosceles * 3 if the triangle is scalene.*/ #include <iostream> #include <cmath> using namespace std; int main(){ double a,b,c; cout<<"enter 3 values of your triangle"<< endl; cin>>a>>b>>c; if( (a==b&& a!=c) || (a==c && a!=b) || (b==c && b!=a) ) { cout<< " This triangle is Isosceles"<<endl; } else if( a==b && a==c){ cout<< "This triangle is equilateral"<<endl; } else if (a!=b && a!=c){ cout<<" This triangle is scalene"<<endl; } return 0; }

  2. Not the answer you are looking for?
    Search for more explanations.

    • Attachments:

Ask your own question

Ask a Question
Find more explanations on OpenStudy

Your question is ready. Sign up for free to start getting answers.

spraguer (Moderator)
5 → View Detailed Profile

is replying to Can someone tell me what button the professor is hitting...

23

  • Teamwork 19 Teammate
  • Problem Solving 19 Hero
  • You have blocked this person.
  • ✔ You're a fan Checking fan status...

Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.