Write a program to accept two angles. Calculate and display whether they are ‘Complementary Angles ‘or
‘Supplementary Angles’ as per the user’s choice .
(note : enter ‘s’ for supplementary or ‘c’ for complementary ) in java
Answers
Answered by
1
import java.util.Scanner
public class angles
{
public static void main (String args [])
{
Scanner scnr =new Scanner(System.in)
System.out.println("Enter first angle");
int a=scnr.nextInt();
System.out.println("Enter second angle");
int b=scnr.nextInt();
if(a+b==180)
{
System.out.println("It is a Supplementry angle");
}
else if(a+b==90)
{
System.out.println("It is a Complementary angle");
}
else
{
System.out.println("Wrong angle");
}
scnr.close();
}
}
Similar questions
Hindi,
1 month ago
Psychology,
1 month ago
Computer Science,
2 months ago
Science,
2 months ago
Science,
9 months ago
History,
9 months ago