0

Mistake

Where is the mistake? int a=3; if (a>0)b=a*a; int c = a+b;

17th Dec 2019, 7:31 AM
Bogomil Atanasov
Bogomil Atanasov - avatar
4 RĂ©ponses
+ 4
It would be easier to say what was NOT a mistake than to list the mistakes. What specifically is this code supposed to do? Where's the rest of it?
17th Dec 2019, 8:15 AM
David Carroll
David Carroll - avatar
+ 4
What about this: ( free interpretation of your code) a=3; if (a>0): b=a*a c = a+b print(f'a = {a}, b = {b}, c = {c}')
17th Dec 2019, 11:08 AM
Lothar
Lothar - avatar
+ 3
You didn't specify a language in the tags, that's the mistake ; )
17th Dec 2019, 8:10 AM
Ipang
+ 1
With about 12 languages in solo learn which are almost similar in terms of their syntax, putting a code like yours and not specifying what language it is written on makes it rather difficult to assist you. Otherwise the issue is with the main() and the return 0; that is if we are talking c++
18th Dec 2019, 9:01 PM
Buhle 💃💃💃
Buhle 💃💃💃 - avatar