Challenge: Operators
The program below outputs 115
. Add a pair of brackets ()
in the statement (10 + 20) * 40 / 10 - 5
changing the order of operations in such a way that it outputs 240
instead.
main.cs
1234567891011namespace TestConsoleApp { internal class Program { static void Main(string[] args) { int result = (10 + 20) * 40 / 10 - 5; System.Console.WriteLine(result); } } }
- Make sure the subtraction is performed in the first step.
main.cs
1234567891011namespace TestConsoleApp { internal class Program { static void Main(string[] args) { int result = (10 + 20) * 40 / (10 - 5); System.Console.WriteLine(result); } } }
Var alt klart?
Tak for dine kommentarer!
Sektion 1. Kapitel 11
Spørg AI
Spørg AI
Spørg om hvad som helst eller prøv et af de foreslåede spørgsmål for at starte vores chat
Awesome!
Completion rate improved to 1.59
Challenge: Operators
Stryg for at vise menuen
The program below outputs 115
. Add a pair of brackets ()
in the statement (10 + 20) * 40 / 10 - 5
changing the order of operations in such a way that it outputs 240
instead.
main.cs
1234567891011namespace TestConsoleApp { internal class Program { static void Main(string[] args) { int result = (10 + 20) * 40 / 10 - 5; System.Console.WriteLine(result); } } }
- Make sure the subtraction is performed in the first step.
main.cs
1234567891011namespace TestConsoleApp { internal class Program { static void Main(string[] args) { int result = (10 + 20) * 40 / (10 - 5); System.Console.WriteLine(result); } } }
Var alt klart?
Tak for dine kommentarer!
Sektion 1. Kapitel 11