//Bonus program using conditional operator
import java.util.Scanner;
class Bonus {
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
System.out.println("Enter an age:");
int age=sc.nextInt();
int b;
b=(age>25)?5000:3000;
System.out.println("Your Bonus:"+b);
}
}
import java.util.Scanner;
class Bonus {
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
System.out.println("Enter an age:");
int age=sc.nextInt();
int b;
b=(age>25)?5000:3000;
System.out.println("Your Bonus:"+b);
}
}
No comments:
Post a Comment