mirror of
https://github.com/pepaskopec-blip/Graduately.git
synced 2026-10-27 15:14:35 +00:00
Add a C# course with a side-by-side code runner.
Each lesson explains a topic and runs the edited program next to the text through the local .NET SDK. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
6662eb185e
commit
333085ee53
86 changed files with 2482 additions and 5 deletions
38
content/programovani/2-rocnik/03-while.md
Normal file
38
content/programovani/2-rocnik/03-while.md
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
---
|
||||
id: cs-2-while
|
||||
nazev: While
|
||||
popis: Opakování, dokud podmínka platí.
|
||||
---
|
||||
|
||||
# Výklad
|
||||
|
||||
## Smyčka
|
||||
*while*
|
||||
|
||||
- Tělo se opakuje, dokud je podmínka true.
|
||||
- Když podmínku nikdy nezměníte, smyčka neskončí.
|
||||
- Aplikace dlouhý běh po chvíli zastaví.
|
||||
|
||||
> Tip: i = i + 1 nebo i++ posune čítač. Bez toho se i nemění.
|
||||
|
||||
## Součet
|
||||
*1 až 4*
|
||||
|
||||
- Začněte součtem 0 a přičítejte i.
|
||||
- 1+2+3+4 je 10.
|
||||
- Podmínka i <= 4 pustí i číslo 4 dovnitř.
|
||||
|
||||
> Tip: Změňte 4 na 10. Součet 1 až 10 je 55.
|
||||
|
||||
# Kód
|
||||
|
||||
```
|
||||
int i = 1;
|
||||
int soucet = 0;
|
||||
while (i <= 4)
|
||||
{
|
||||
soucet = soucet + i;
|
||||
i++;
|
||||
}
|
||||
Console.WriteLine(soucet);
|
||||
```
|
||||
Loading…
Add table
Add a link
Reference in a new issue