Triangle নামে ক্লাস ডিক্লেয়ার করে ত্রিভুজের ক্ষেতফল নির্ণয়ের জাভা প্রোগ্রাম

import java.util.* ;

    public class Triangle {

        public static void main(String[ ]args){

            double a, b, c, s, area;

            Scanner in= new Scanner(System.in);

                System.out.print("Enter three values for a, b and c : ");

                a = in.nextDouble ( );

                b = in.nextDouble ( );

                c = in.nextDouble ( );

                    if ((a+b)>c && (b+c)>a && (c+a)>b){

                    s = (a+b+c)/2 ;

                    area = Math.sqrt(s*(s-a)*(s-b)*(s-c));

                        System.out.print("The area of triangle is :" +area);

                    }

                    else

                        System.out.print("Triangle is not possible ");

            }

    }


Next Post Previous Post
No Comment
Add Comment
comment url