write a program in Java to enter any angle and check whether it is a right angle straight angle acute angle obtuse angle or reflex angle
(use if else statment)and(scanner class)
Answers
import java.util.Scanner;
public class Angles {
static String getType(float angle) {
if (angle < 90) return "Acute";
else if (angle = = 90) return "Right";
else if (angle > 90 && angle < 180) return "Obtuse";
else if (angle = = 180) return "Straight";
return "Reflex";
}
public static void main(String[ ] args) {
System.out.print("Enter an Angle - ");
float angle = new Scanner(System.in).nextFloat( );
System.out.printf("It's %s Angle.", getType(angle));
}
}
Answer:
import java.util.*;
import java.io.*;
class GFG
{
// Function to print the series
static void printPattern(int N)
{
for (int i = 1; i <= N; i++) {
// Find and print the ith term
System.out.print(" "+((i % 2 == 0) ? (i - 1) : (i + 1)));
}
}
// Driver code
public static void main(String args[])
{
// Get the value of N
int N = 10;
// Print the Series
printPattern(N);
}
}
Explanation:
import java.util.*;
import java.lang.*;
import java.io.*;
class GFG
{
// Function to print the series
static void printPattern(int N)
{
for (int i = 1; i <= N; i++) {
// Find and print the ith term
System.out.print(" "+((i % 2 == 0) ? (i - 1) : (i + 1)));
}
}
// Driver code
public static void main(String args[])
{
// Get the value of N
int N = 10;
// Print the Series
printPattern(N);
}
}
hope it helps
please mark me as brainliest