Answer to Question #214312 in Python for Siva

Question #214312

Calculate Double or Triple

Write a program to print the triple of number

N if it is a multiple of 3 otherwise, double of N.Input

The first line is an integer

N.Output

The output should be an integer based on the above conditions.

Explanation

In the given example

N = 3, As 3 is a multiple of 3, we multiply the value by 3. So, the output should be 9.

Sample Input 1

3

Sample Output 1

9

Sample Input 2

4

Sample Output 2

8




1
Expert's answer
2021-07-06T07:21:59-0400
N = int(input())
if N % 3 == 0:
	N *= 3
else:
	N *= 2
print(N)

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS