BasicKnowledgeCSharp/LessonsAndTasks/Lesson 11 - Инкремент и декремент. Постфиксный и префиксный/Program.cs
Dvurechensky bf6a7c2b4e 1.1
2025-05-12 02:48:54 +03:00

32 lines
850 B
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
* Author: Nikolay Dvurechensky
* Site: https://www.dvurechensky.pro/
* Gmail: dvurechenskysoft@gmail.com
* Last Updated: 12 мая 2025 02:47:11
* Version: 1.0.3
*/
using System;
/*
* Инкремент и декремент. Постфиксный и префиксный.
*/
class Program
{
static void Main()
{
int a = 0;
int b = 1;
a++; // Постфиксная - Сначала выведется переменная до инкремента а потом после него
--a; // Префиксная - Сначала сработает увеличение переменной а результат выведется в консоль
a--;
a--;
b = ++b * b;
Console.WriteLine(a);
Console.WriteLine(b);
Console.ReadKey();
}
}