You are on page 1of 1

1. Q.

Create example to calculate percentage – SUM,Sub, Mul,Div

Integer num1 = 12;

Integer num2 = 4;

String oper = 'Sum ';

if (oper == 'sum'){

system.debug('Addition : '+(num1+num2));

if (oper == 'sub'){

system.debug('substraction : '+(num1-num2));

if (oper == 'Mul'){

system.debug('Multiplication : '+(num1*num2));

if (oper == 'Div'){

system.debug('Division : '+(num1/num2));

You might also like