Hello! This is Kenneth J Han!
In this post, we are going to look at basic operators.
003. Operators
Problem
Put 7 in variable "num1", and put 2 in variable "num2".
Then calculate the two operands : "add +", "subtract -", "multiply *", "divide /", "remainder %" and power.
Then calculate the two operands : "add +", "subtract -", "multiply *", "divide /", "remainder %" and power.
Pseudocode
num1 ← 7
num2 ← 2
PRINT num1 + num2
PRINT num1 - num2
PRINT num1 * num2
PRINT num1 / num2
PRINT num1 % num2
PRINT POW(num1, num2)
num2 ← 2
PRINT num1 + num2
PRINT num1 - num2
PRINT num1 * num2
PRINT num1 / num2
PRINT num1 % num2
PRINT POW(num1, num2)
Answer
9
5
14
3.5
1
49
5
14
3.5
1
49
Your source code is on ready to serve!
Python source code answer on Github
Java source code answer on Github
See you on next post!
0 κ°μ λκΈ:
Post a Comment