You are on page 1of 4

1)

Input: num1, num2


Processing:
1)case ‘+’ : result = num1 + num2;
2)case ‘-’ : result = num1 - num2;
3)case ‘*’ : result = num1 * num2;
4)case ‘/’ : if ( num2==0)
result = num1 + num2

Output: print out result

result = num1 - num2

INPUT : NUM 1, NUM 2 OPERATOR

result = num1 * num2;

case ‘/’ : if ( num2==0)

Exercise 2
Input: A=[5]
Processing: min A[0] For A=1, i<5 If a[i]<min then Min=a[i]
Output:min
Output:Takes 9

true

false

true

false

true

false
Exercise 3
Input:

Processing:

Sum=0

While(num!=0)

Accept num

Sum= sum+sum

Output: print out the result

Exercise 4 Suppose that: Input: n, income


Processing:
pa = 9 000 000
pd = 3 600 000
tf=12*(pa +n*pd)
ti= income – tf
if (ti <= 0 ) {
income tax = 0
}
else if (ti > 0 && ti <= 5 000 000 ) {
income tax = ti * 5/100;
}
else if (ti >= 5 000 001 && ti <= 10 000 000) {
income tax = 5 000 000 * 5/100 + (ti – 5 000 000) * 10/100
}
else if (ti >= 10 000 001 && ti <= 18 000 000) {
income tax = 5 000 000 * 5/100 + 5 000 000 * 10/100 + (ti – 10 000 000) * 15/100
}
else {
income tax = 5 000 000 * 5/100 + 5 000 000 * 10/100 + 8 000 000 * 15/100 + (ti –
18 000 000) * 20/100
}
return 0
Output: print out income, ti, income tax

You might also like