Click here to Skip to main content
15,917,568 members
Home / Discussions / C#
   

C#

 
AnswerRe: add two integers using using c#.NET Pin
Christian Graus10-Jan-07 0:24
protectorChristian Graus10-Jan-07 0:24 
GeneralRe: add two integers using using c#.NET Pin
Pete O'Hanlon10-Jan-07 0:33
mvePete O'Hanlon10-Jan-07 0:33 
GeneralRe: add two integers using using c#.NET Pin
Christian Graus10-Jan-07 0:48
protectorChristian Graus10-Jan-07 0:48 
AnswerRe: add two integers using using c#.NET Pin
Pete O'Hanlon10-Jan-07 0:34
mvePete O'Hanlon10-Jan-07 0:34 
GeneralRe: add two integers using using c#.NET Pin
Colin Angus Mackay10-Jan-07 2:07
Colin Angus Mackay10-Jan-07 2:07 
GeneralRe: add two integers using using c#.NET Pin
Pete O'Hanlon10-Jan-07 3:10
mvePete O'Hanlon10-Jan-07 3:10 
AnswerRe: add two integers using using c#.NET Pin
ednrgc10-Jan-07 2:31
ednrgc10-Jan-07 2:31 
JokeRe: add two integers using using c#.NET (with sample code) Pin
szukuro10-Jan-07 5:31
szukuro10-Jan-07 5:31 
public long Sum(int a, int b)<br />
    { <br />
        long f = 0;<br />
        for (int i = 0; i < a; i++)<br />
        {if (f % 2 == 0)<br />
            {f ^= 1;}<br />
            else<br />
            {int k = 0;<br />
                long e = f;<br />
                while (e % 2 == 1)<br />
                {e = e >> 1;<br />
                k++;}<br />
                int l = 1;<br />
                for (int j = 0; j < k; j++)<br />
                {l = l << 1;<br />
                 l ^= 1;}<br />
                f ^= l;}}<br />
        for (int i = 0; i < b; i++)<br />
        {if (f % 2 == 0)<br />
            {f ^= 1;}<br />
            else<br />
            {int h = 0;<br />
                long g = f;<br />
                while (g % 2 == 1)<br />
                {g = g >> 1;<br />
                h++;}<br />
                int l = 1;<br />
                for (int j = 0; j < h; j++)<br />
                {l = l << 1;<br />
                 l ^= 1;}<br />
                f ^= l;}}<br />
        return f;<br />
    }


Usage example: Sum(3,4). Will return 7.
GeneralRe: add two integers using using c#.NET (with sample code) Pin
Luc Pattyn10-Jan-07 8:33
sitebuilderLuc Pattyn10-Jan-07 8:33 
GeneralRe: add two integers using using c#.NET (with sample code) Pin
szukuro10-Jan-07 10:57
szukuro10-Jan-07 10:57 
GeneralRe: add two integers using using c#.NET (with sample code) Pin
Alaric_10-Jan-07 11:26
professionalAlaric_10-Jan-07 11:26 
GeneralRe: add two integers using using c#.NET (with sample code) Pin
Glen Harvy10-Jan-07 13:34
Glen Harvy10-Jan-07 13:34 
Questiondll Pin
raju_net18189-Jan-07 23:47
raju_net18189-Jan-07 23:47 
AnswerRe: dll Pin
Stefan Troschuetz9-Jan-07 23:52
Stefan Troschuetz9-Jan-07 23:52 
QuestionProblem with a configuration file [modified] Pin
Tania-chan9-Jan-07 23:33
Tania-chan9-Jan-07 23:33 
QuestionAsynchronous Webservice call and abort Pin
Jens Meyer9-Jan-07 23:25
Jens Meyer9-Jan-07 23:25 
QuestionHow to get HTML source of Webpage in C# ? Pin
Supriya Tonape9-Jan-07 22:45
Supriya Tonape9-Jan-07 22:45 
AnswerRe: How to get HTML source of Webpage in C# ? Pin
Ravi Bhavnani10-Jan-07 2:27
professionalRavi Bhavnani10-Jan-07 2:27 
GeneralRe: How to get HTML source of Webpage in C# ? Pin
Supriya Tonape10-Jan-07 2:46
Supriya Tonape10-Jan-07 2:46 
QuestionC# and Games Pin
kbalias9-Jan-07 22:43
kbalias9-Jan-07 22:43 
AnswerRe: C# and Games Pin
J4amieC9-Jan-07 22:53
J4amieC9-Jan-07 22:53 
AnswerRe: C# and Games Pin
Pete O'Hanlon9-Jan-07 22:55
mvePete O'Hanlon9-Jan-07 22:55 
AnswerRe: C# and Games Pin
Colin Angus Mackay9-Jan-07 23:16
Colin Angus Mackay9-Jan-07 23:16 
AnswerRe: C# and Games Pin
Christian Graus9-Jan-07 23:29
protectorChristian Graus9-Jan-07 23:29 
GeneralRe: C# and Games Pin
Pete O'Hanlon9-Jan-07 23:36
mvePete O'Hanlon9-Jan-07 23:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.