BasicKnowledgeCSharp/LessonsAndTasks/Lesson 11 - Инкремент и декремент. Постфиксный и префиксный/Program.cs
Dvurechensky 058c8f2679 1.0
Main
2024-10-05 09:59:53 +03:00

24 lines
675 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.

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();
}
}