Skip to content

Commit 8c4f427

Browse files
Add files via upload
1 parent 01d4566 commit 8c4f427

3 files changed

Lines changed: 54 additions & 0 deletions

File tree

AreaOfScalene.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import java.util.*;
2+
public class AreaOfScalene
3+
{
4+
public static void main(String args[])
5+
{
6+
double s1, s2, s3, s, area;
7+
Scanner sc=new Scanner (System.in);
8+
System.out.println("Enter 3 sides of a triangle: ");
9+
s1=sc.nextDouble();
10+
s2=sc.nextDouble();
11+
s3=sc.nextDouble();
12+
s=(s1+s2+s3)/2;
13+
area=Math.sqrt(s*(s-s1)*(s-s2)*(s-s3));
14+
System.out.println("Area of Triangle= "+area);
15+
}
16+
}

BMI.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import java.util.*;
2+
public class BMI
3+
{
4+
public static void main(String args[])
5+
{
6+
System.out.print("Enter your height and weight:");
7+
Scanner sc=new Scanner(System.in);
8+
double height=sc.nextDouble();
9+
int weight=sc.nextInt();
10+
double a=height*height;
11+
if ((weight/a)<19)
12+
System.out.println("You are Underweight.");
13+
else if ((weight/a)>=19 && ((weight/a)<=25))
14+
System.out.println("You are Healthy.");
15+
else if ((weight/a)>25)
16+
System.out.println("You are Overweight.");
17+
else
18+
System.out.println("Invalid Value Entered.");
19+
}
20+
}

PerfectSquare.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
public class PerfectSquare
2+
{
3+
public static void main(String args[])
4+
{
5+
for (int i=32; i<=99; i++)
6+
{
7+
int ps=i*i;
8+
int d1=(ps/100)/10;
9+
int d2=(ps/100)%10;
10+
int d3=(ps%100)/10;
11+
int d4=(ps%100)%10;
12+
if (d1==d2 && d3==d4)
13+
{
14+
System.out.println("Perfect Square Number: "+ps);
15+
}
16+
}
17+
}
18+
}

0 commit comments

Comments
 (0)