0

# addition three integer

i tried it with the code: a=int(input(2)) b=int(input(4)) c=int(input(8)) sum=a+b+c print=(sum) but it only takes the first number 'a'... number 4 but the result should be 14 can anyone tell me what i am doing wrong, please?

5 Antworten

+ 1

not print=(sum), it should be print(sum)

+ 1

And what are the inputs you are giving to this code?
input(2) will just print 2 in the command line until you give the input you want to give to assign as "a".
This is similar to input("write your number") then code prints the phrase "write your number" and waits for the input to be given by the user.

+ 1

a=int(input())
b=int(input())
c=int(input())
sum=a+b+c
print(sum)
If you run this in sololearn, you have to give the inputs at the same time, just separate them by new lines. That's it.

0

@R_A
thank you very much for your answers
i tried to write a code that a=2, b=4 and c=8, as a number while using input() and in the second part, that it calculates a+b+c (2+4+8) ... so how would i need to write it, that the input would be the number?
if i do it like this it works:
a=2
b=4
c=7
x=a+b+c
print(x)
however i want to use
a=input()
...
:)

0

Remove numbers from the paranthesis at all 3 inputs and remove the = before (sum)