Computer Science, asked by gangiredlavenkatarao, 6 hours ago

Finding Range Of The Number
Write a java program to find the range of the entered value.

a)If the entered value is greater than 0 and less than or equal to 100 then display "Range of the number is 0 to 100"

b)If the entered value is greater than 100 and less than or equal to 200 then display "Range of the number is 100 to 200"

c)If the entered value is greater than 200 and less than or equal to 500 then display "Range of the number is 200 to 500"

If the given number is not in the above list then display "Entered number is not in the expected range".

Answers

Answered by ItzMeSam35
1

import java.util.Scanner;

public class Range

{

public static void main (String args [])

{

Scanner sc=new Scanner(System.in);

System.out.print("Please enter a value : ");

double value = sc.nextDouble();

if (value > 0 && value <= 100)

{

System.out.println("Range of the number is 0 to 100");

}

else if (value > 100 && value <= 200)

{

System.out.println("Range of the number is 100 to 200);

}

else if (value > 200 && value <= 500)

{

System.out.println("Range of the number is 200 to 500);

}

else

{

System.out.println("Entered number is not in the expected range");

}

sc.close();

}

}

Similar questions