What is the result to this code | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 2

What is the result to this code

X="a" X*=3 Print(x)

8th Apr 2017, 7:17 AM
6 Réponses
+ 1
The result to this code is aaa
8th Apr 2017, 10:04 PM
Fernando Elindo
Fernando Elindo - avatar
+ 10
In which language?
24th Apr 2017, 10:52 PM
Ismail - avatar
+ 9
Depends for which compiler you write it but literally X="a" X*=3 Print(x) must to be "UNDEFINED" because usually x in lowercase is not the same X in uppercase
8th Apr 2017, 7:45 AM
Daniel - avatar
+ 7
If a string is multiplied by an integer, it results in the string repeated the integer number of times. So, "a" multiplied by 3 returns "a" repeated 3 times i.e. "aaa". And, it works if you print X but not x.
8th Apr 2017, 2:13 PM
Krishna Teja Yeluripati
Krishna Teja Yeluripati - avatar
+ 2
its answer will be aaa I think
8th Apr 2017, 7:19 AM
m8riix - avatar
+ 2
hm not so sure about that. but all you have to do is plug it in and try
8th Apr 2017, 7:26 AM