Computer Science, asked by osama2749, 2 months ago

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 kumarsujal23209z
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