Created
June 12, 2020 10:15
-
-
Save Svastikkka/3250d31d38f8d320336b3d84c3e7e0e6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
num=int(input()) | |
c=int(input()) | |
if c==1: | |
res=0 | |
for i in range(1,num+1): | |
res=res+num | |
num=num-1 | |
print(res) | |
elif c==2: | |
res=1 | |
for i in range(1,num+1): | |
res=res*num | |
num=num-1 | |
print(res) | |
else:print(-1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sum or Product