0% found this document useful (0 votes)
42 views4 pages

Prob C

The document discusses an assignment on arithmetic operations where the student is given two numbers and must calculate the addition, subtraction, multiplication, division, and modulus of the two numbers. The operations are addition, subtraction, multiplication, division, and modulus. The input is two numbers on one line and the output is five lines with the results of each operation in sequence.

Uploaded by

Charles Wido
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
42 views4 pages

Prob C

The document discusses an assignment on arithmetic operations where the student is given two numbers and must calculate the addition, subtraction, multiplication, division, and modulus of the two numbers. The operations are addition, subtraction, multiplication, division, and modulus. The input is two numbers on one line and the output is five lines with the results of each operation in sequence.

Uploaded by

Charles Wido
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

E

COMP6047 – Algorithm and Programming

T
T
NO
BU
Arithmetic
Today, you got an assignment about arithmetic. You saw a lot of questions there with a
pattern, which is just a simple arithmetic. The questions include addition, subtraction,
multiplication, division, and remainder of a division.

I
As now you can make a basic program, you won’t bother to calculate them one by one.

R
O
You are given 2 numbers A and B, calculate the addition, subtraction, multiplication,
division, and remainder of division of A by B.
T
For your reference, this is the list of operators you need
D

1. Addition: +
S
2. Subtraction: -

3. Multiplication: *
DI

4. Division: /

5. Modulus (remainder of division): %


OT
UT
Note that you have to print exactly one newline character (‘\n’) at the end of your
RE

answer, otherwise your answer will be judged wrong.

Format Input
N
IB
The input consist of two numbers in a line A and B, respectively.

Format Output
The output consists of 5 line each containing a number. Output with the following
TR
DO

sequence: addition, subtraction, multiplication, division, remainder of division.

Constraints
• 1 ≤ A ≤ 1000
IS

• 1 ≤ B ≤ 1000
ED

© School of Computer Science - BINUS, 2021. No part of the materials available may be copied,
photocopied, reproduced, translated, or reduced to any electronic medium or machine-readable form,
in whole or in part, without prior written consent of School of Computer Science - BINUS. Any other
reproduction in any form without the permission of School of Computer Science - BINUS is probihited.
Violators of this clause may be academically sanctioned.
E
COMP6047 – Algorithm and Programming

T
T
Sample Input (standard input)

NO
BU
16 5

Sample Output (standard output)


21

I
11
80

R
O
3
1 T
D
S
DI

OT
UT
RE

N
IB
TR
DO
IS
ED

© School of Computer Science - BINUS, 2021. No part of the materials available may be copied,
photocopied, reproduced, translated, or reduced to any electronic medium or machine-readable form,
in whole or in part, without prior written consent of School of Computer Science - BINUS. Any other
reproduction in any form without the permission of School of Computer Science - BINUS is probihited.
Violators of this clause may be academically sanctioned.
E
COMP6047 – Algorithm and Programming

T
T
NO
BU
Arithmetic
Hari ini kamu mendapatkan sebuah tugas tentang aritmatika. Kamu melihat banyak
pertanyaan dengan pola yang sama, yaitu beberapa pertanyaan aritmatika sederhana.
Pertanyaan yang ada pada tugas tersebut mencakup pertambahan, pengurangan, perkalian,
pembagian, dan sisa pembagian.

R I
O
Dengan kemampuanmu sekarang ini yang sudah bisa membuat sebuah program sederhana,
kamu tidak akan menyusahkan diri dengan menghitung semua pertanyaan secara manual.
Kamu diberikan 2 angka integer A dan B, hitunglah hasil pertambahan, pengurangan,
T
perkalian, pembagian, dan sisa pembagian A oleh B.
D

Untuk referensi, ini adalah daftar operator yang anda butuhkan


S
1. Pertambahan: +
DI

2. Pengurangan: -

3. Perkalian: *

4. Pembagian: /
OT
UT
RE

5. Modulus (sisa bagi): %

Perhatikan bahwa kamu harus mencetak tepat satu karakter newline/baris baru (‘\n’)
di akhir jawaban, jika tidak jawabanmu akan dianggap salah.
N
IB
Format Input
Input terdiri dari 2 angka integer dalam satu baris, A dan B.
TR
DO

Format Output
Output terdiri dari 5 baris masing-masing mengandung 1 angka.
Lakukan output dengan urutan berikut: pertambahan, pengurangan, perkalian, pembagian,
sisa pembagian.
IS

Constraints
• 1 ≤ A ≤ 1000

• 1 ≤ B ≤ 1000
ED

© School of Computer Science - BINUS, 2021. No part of the materials available may be copied,
photocopied, reproduced, translated, or reduced to any electronic medium or machine-readable form,
in whole or in part, without prior written consent of School of Computer Science - BINUS. Any other
reproduction in any form without the permission of School of Computer Science - BINUS is probihited.
Violators of this clause may be academically sanctioned.
E
COMP6047 – Algorithm and Programming

T
T
Sample Input (standard input)

NO
BU
16 5

Sample Output (standard output)


21

I
11
80

R
O
3
1 T
D
S
DI

OT
UT
RE

N
IB
TR
DO
IS
ED

© School of Computer Science - BINUS, 2021. No part of the materials available may be copied,
photocopied, reproduced, translated, or reduced to any electronic medium or machine-readable form,
in whole or in part, without prior written consent of School of Computer Science - BINUS. Any other
reproduction in any form without the permission of School of Computer Science - BINUS is probihited.
Violators of this clause may be academically sanctioned.

You might also like