Computer Science, asked by falaquejahan1928, 10 months ago

write a statement that uses a conditional operator to store in discount 10% of sale if sale is more than 5000 otherwise store in discount 5% of sale​

Answers

Answered by anishasa
1

Answer:

Ternary Operator:

variable x = (expression) ? value if true: value if false

int b,c;

Scanner ob=new Scanner(System.in); System.out.println("Enter the marked price");

int MP=ob.nextInt();

c=(MP>5000)?MP-(MP*10)100:MP-(MP*5)/100;

System.out.println(c);

Similar questions