Problem Statement
Implement a program to calculate the product of three positive integer values. However, if one
of the integers is 7, consider only the values to the right of 7 for calculation. If 7 is the last
integer, then display -1.
Note: Only one of the three values can be 7.
Sample Input and Output
Sample Input
Expected Output
1, 5, 3
15
3, 7, 8
8
7,29
18
2, 6, 7
-1
Answers
Answered by
0
Answer:
7,29
Explanation:
because the right value of the integer is 7 itself
Answered by
1
product of three positive integer values
Explanation:
Given:
if one of the integers is 7
consider only the values to the right of 7
If 7 is the last integer, then display -1
Expected Output:
1, 5, 3
15
3, 7, 8
8
algorithm:
a, b, c = map(int, input().split())
if c == 7: print(-1)
elif b == 7: print(c)
elif a == 7: print(b*c)
else: print(a*b*c)
hence, above is the required program to calculate the product of three positive integer values
Similar questions