Saturday, 2 April 2016

Q.Write an algorithm that reads three nonzero double values and determines and prints whether they could represent the sides of a triangle.

#include<stdio.h>
#include<conio.h>


void main()
{
double x,y,z;
printf("Enter the value of x:");
scanf("%lf",&x);
printf("Enter the value of y:");
scanf("%lf",&y);
printf("Enter the value of z:");
scanf("%lf",&z);
if((x+y>z)&&(y+z>x)&&(x+z>y))
printf("Represents the sides of a Triangle");
else
printf("Don't Represents the sides of a Triangle");
getch();

1 comment:

  1. For java? Do you have answer for that same question?

    ReplyDelete