Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lära Challenge: Operators | Getting Started
C# Basics
course content

Kursinnehåll

C# Basics

C# Basics

1. Getting Started
2. Dealing with Data Types
3. Control Structures
4. Loops
5. Arrays
6. Methods

book
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.

cs

main

copy
1234567891011
namespace TestConsoleApp { internal class Program { static void Main(string[] args) { int result = (10 + 20) * 40 / 10 - 5; System.Console.WriteLine(result); } } }
  1. Make sure the subtraction is performed in the first step.

cs

main

copy
1234567891011
namespace TestConsoleApp { internal class Program { static void Main(string[] args) { int result = (10 + 20) * 40 / (10 - 5); System.Console.WriteLine(result); } } }

Var allt tydligt?

Hur kan vi förbättra det?

Tack för dina kommentarer!

Avsnitt 1. Kapitel 11

Fråga AI

expand
ChatGPT

Fråga vad du vill eller prova någon av de föreslagna frågorna för att starta vårt samtal

course content

Kursinnehåll

C# Basics

C# Basics

1. Getting Started
2. Dealing with Data Types
3. Control Structures
4. Loops
5. Arrays
6. Methods

book
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.

cs

main

copy
1234567891011
namespace TestConsoleApp { internal class Program { static void Main(string[] args) { int result = (10 + 20) * 40 / 10 - 5; System.Console.WriteLine(result); } } }
  1. Make sure the subtraction is performed in the first step.

cs

main

copy
1234567891011
namespace TestConsoleApp { internal class Program { static void Main(string[] args) { int result = (10 + 20) * 40 / (10 - 5); System.Console.WriteLine(result); } } }

Var allt tydligt?

Hur kan vi förbättra det?

Tack för dina kommentarer!

Avsnitt 1. Kapitel 11
Vi beklagar att något gick fel. Vad hände?
some-alt