dimanche 27 août 2017

how to create 3 variables equal together.

i am making a code which identify if its equilateral, isosceles and scalene but i am having trouble coding at equilateral part because the size should be equal here's my code.

:triangle
echo enter the three size:
echo size a
set /p s1=
echo size b
set /p s2=
echo size c
set /p s3=

:: Isosceles triangle 

if %s1%==%s2% (
    goto isosceles
    ) else if %s1%==%s3% (
    goto isosceles
    ) else ( 
    goto scalene
    )
pause

:: equilateral triangle

if %s1%==%s2%==%s3% (
    goto equilateral
)   
pause   

:: for triangles 
:equilateral
echo the triangle is equilateral 
goto pause
:scalene
echo the triangle is scalene 
goto pause 
:isosceles
echo the triangle is isosceles 
goto pause

is my equilateral statement correct?

Aucun commentaire:

Enregistrer un commentaire