Results 1 to 2 of 2

Thread: C sharp program for swapping number

  1. #1
    HernandezOrtiz is offline Senior Member
    Join Date
    Dec 2009
    Posts
    301
    Rep Power
    3

    Default C sharp program for swapping number

    I am learning the C# language. I have tried one program, but I am getting too many errors during its code execution. Is anybody has the C sharp code to swapping number then please share with me.

  2. #2
    MartinWilson is offline Senior Member
    Join Date
    Dec 2009
    Posts
    281
    Rep Power
    3

    Default

    There two methods to swap the number

    A)Using temp variable

    int a, b;

    Public static void Swap(a, b)
    {
    int temp
    temp= a;

    a= b;

    a = temp;
    }

    B) Without using temp variable

    int a, b;
    {
    a=a + b;

    b=a – b;

    a=a – b;
    }

Similar Threads

  1. Write a C++ program that reads a floating point number
    By FosterWood in forum Programming
    Replies: 1
    Last Post: 06-15-2010, 02:36 PM
  2. C code for given number is Armstrong number or not
    By RussellBarnes in forum Programming
    Replies: 1
    Last Post: 05-29-2010, 12:01 PM
  3. Replies: 2
    Last Post: 05-14-2010, 01:30 PM
  4. Program to write prime factor of given number:
    By BrooksGray in forum Programming
    Replies: 2
    Last Post: 01-14-2010, 06:18 PM
  5. C program to reverse a number
    By Millerjames in forum Programming
    Replies: 1
    Last Post: 01-13-2010, 05:42 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
SEO by SubmitEdge

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48