Write a program to input an integer and output whether or not it is a valid percentage
if anyone could help that would be great
Thanks in advance!
import java.util.*; class CheckPercentage { public static void main(String[] args) { Scanner input=new Scanner(System.in); System.out.print("Enter percent: "); double percent=input.nextDouble(); if((percent>0)&&(percent<=100)){ System.out.println("Valid Percentage."); } else{ System.out.println("Not Valid!"); } } }
Ads