Mix increment operator and normal operator - CSharp Language Basics

CSharp examples for Language Basics:Operator

Description

Mix increment operator and normal operator

Demo Code

using System;//from  w  ww .  ja v  a2s . c o m
class Library
{
   public static void Main()
   {
      int numProgrammingBooks = 2;
      int numStatisticsBooks = 1;
      int numActionBooks = 504;
      int totalBooks;
      totalBooks = ++numActionBooks + numProgrammingBooks + numStatisticsBooks;
      Console.WriteLine("Number of action books: " + numActionBooks);
      Console.WriteLine("Total number of books: " + totalBooks);
   }
}

Result


Related Tutorials