Click here to Skip to main content
15,900,725 members
Home / Discussions / C#
   

C#

 
GeneralRe: c# Brain teaser Pin
thelastjedi20-Jun-06 3:23
thelastjedi20-Jun-06 3:23 
GeneralRe: c# Brain teaser Pin
izakfick20-Jun-06 3:31
izakfick20-Jun-06 3:31 
AnswerRe: c# Brain teaser Pin
thelastjedi20-Jun-06 3:36
thelastjedi20-Jun-06 3:36 
GeneralRe: c# Brain teaser Pin
izakfick20-Jun-06 3:42
izakfick20-Jun-06 3:42 
GeneralRe: c# Brain teaser Pin
izakfick20-Jun-06 3:43
izakfick20-Jun-06 3:43 
GeneralRe: c# Brain teaser Pin
thelastjedi20-Jun-06 4:08
thelastjedi20-Jun-06 4:08 
GeneralRe: c# Brain teaser Pin
izakfick20-Jun-06 4:10
izakfick20-Jun-06 4:10 
AnswerRe: c# Brain teaser Pin
thelastjedi20-Jun-06 4:38
thelastjedi20-Jun-06 4:38 
using System;

namespace ConsoleApplication2
{
///
/// Summary description for Class1.
///

class Class1
{
///
/// The main entry point for the application.
///
[STAThread]
static void Main(string[] args)
{
Calculate c = new Calculate();

c.initCalc();
System.Console.WriteLine ("Done");
System.Console.Read ();
}
}
public class Calculate
{

int[] intArray = {1,2,3,4,5,6,7,8,9};

public void initCalc()
{
string s_out = "";
int iTotal = 0;
int j=0;
for(int i = 0; i < intArray.Length; i++)
{
iTotal = intArray[i];
s_out = intArray[i].ToString() + " + ";
j=i;
calc(intArray, j, s_out, iTotal);
}
}

public string calc(int[] intArray, int j, string s_out, int iTotal)
{
String s_out2;
if(iTotal == 10)
{
s_out = s_out.Substring(0,s_out.LastIndexOf("+")-1) + " = " + iTotal.ToString();
Console.WriteLine(s_out);
}

while(iTotal < 10 && j<intarray.length)
{
="" itotal="iTotal" +="" intarray[j];
="" s_out2="s_out;
" s_out="s_out" intarray[j].tostring()="" "="" ";
="" calc(intarray,j,s_out,="" itotal);
="" -="" j++;
="" }
="" if(itotal="">10)
{
s_out = "";
}
return s_out;
}
}

}


Jedi
GeneralRe: c# Brain teaser Pin
izakfick20-Jun-06 4:49
izakfick20-Jun-06 4:49 
GeneralRe: c# Brain teaser Pin
thelastjedi20-Jun-06 5:07
thelastjedi20-Jun-06 5:07 
GeneralRe: c# Brain teaser Pin
izakfick20-Jun-06 5:40
izakfick20-Jun-06 5:40 
AnswerRe: c# Brain teaser Pin
Guffa20-Jun-06 4:09
Guffa20-Jun-06 4:09 
AnswerRe: c# Brain teaser Pin
athulathulsi12-Mar-12 22:06
athulathulsi12-Mar-12 22:06 
QuestionList All Web Methods In a WebService!! Pin
Comdesign20-Jun-06 2:27
Comdesign20-Jun-06 2:27 
AnswerRe: List All Web Methods In a WebService!! Pin
Dustin Metzgar22-Jun-06 13:32
Dustin Metzgar22-Jun-06 13:32 
QuestionDisabling keyboard keys Pin
Prashant Gadhave20-Jun-06 2:09
Prashant Gadhave20-Jun-06 2:09 
AnswerRe: Disabling keyboard keys Pin
J4amieC20-Jun-06 2:28
J4amieC20-Jun-06 2:28 
GeneralRe: Disabling keyboard keys Pin
Prashant Gadhave20-Jun-06 2:38
Prashant Gadhave20-Jun-06 2:38 
GeneralRe: Disabling keyboard keys Pin
J4amieC20-Jun-06 2:57
J4amieC20-Jun-06 2:57 
GeneralRe: Disabling keyboard keys Pin
Prashant Gadhave20-Jun-06 18:11
Prashant Gadhave20-Jun-06 18:11 
GeneralRe: Disabling keyboard keys Pin
nueer20-Jun-06 2:55
nueer20-Jun-06 2:55 
GeneralRe: Disabling keyboard keys Pin
thelastjedi20-Jun-06 3:05
thelastjedi20-Jun-06 3:05 
GeneralRe: Disabling keyboard keys Pin
Dan Neely20-Jun-06 3:07
Dan Neely20-Jun-06 3:07 
GeneralRe: Disabling keyboard keys Pin
nueer20-Jun-06 3:27
nueer20-Jun-06 3:27 
GeneralRe: Disabling keyboard keys Pin
Dan Neely20-Jun-06 5:16
Dan Neely20-Jun-06 5:16 

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.