+ 1

Code Playground / Compiler ???

can you guys tell me about code playground , honestly i am very confused because my code always get error like the error code example, other people say it's not interactive code playground , but actually I don't know why it's like that. https://code.sololearn.com/cKEfe0Mg06ph/?ref=app https://code.sololearn.com/cXfjZ12Sdfqr/?ref=app

8th Feb 2022, 8:55 AM
Zarediq Bat
Zarediq Bat - avatar
2 Respostas
+ 3
Zarediq Bat Sololearn compiler accept all inputs together with separate lines. So if you take input inside loop then you have to provide all inputs. If you use while (true) then your loop should break after some condition otherwise you will get error Please make c# variable start with small character. Class name and method name start with Capital letter in C#. Like this: int incomeperMnt, gross, people; incomeperMnt = Convert.ToInt32(Console.ReadLine()); gross = Convert.ToInt32(Console.ReadLine()); people = Convert.ToInt32(Console.ReadLine()); // while(true) { int netProfit = incomeperMnt - gross; int shareHolders = netProfit / people; int profit = shareHolders; Console.WriteLine(profit + " / Persons"); //}
8th Feb 2022, 9:08 AM
A͢J
A͢J - avatar
+ 1
it's not an interactive playground, you can't interact with the console directly. the code you run on Sololearn does not get compiled on your phone. it is compiled on a server, and the server returns the output to be displayed without any further interaction. both of your codes have while(true) when you click run, the code gets executed on the server and there's no way to interact with it. if your code results in an infinite loop it will stop after some iterations.
8th Feb 2022, 9:11 AM
Bahhaⵣ
Bahhaⵣ - avatar