using System;
class PrePostDemo {
  public static void Main() {
    int x, y;
    int i;
    x = 1;
    Console.WriteLine("Series generated using y = x + x++;");
    for(i = 0; i < 10; i++) {
      y = x + x++; // postfix ++
      Console.WriteLine(y + " ");
    }
    Console.WriteLine();
    x = 1;
    Console.WriteLine("Series generated using y = x + ++x;");
    for(i = 0; i < 10; i++) {
      y = x + ++x; // prefix ++
      Console.WriteLine(y + " ");
    }
    Console.WriteLine();
  }
}
Friday, September 5, 2008
C# program to Demonstrate the difference between prefix
Posted by Nanya at 6:59 AM
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment