Computer Progammers? HELP NEEDED (C#)

197
10
Joined
May 15, 2007
as stated above I need some help finding out how to develop a factorial calculator using c#... if someone could pm me thatd be great.. dont wanna get in trouble in case someone thinks this is for homework...
 
as stated above I need some help finding out how to develop a factorial calculator using c#... if someone could pm me thatd be great.. dont wanna get in trouble in case someone thinks this is for homework...
 
Damn I hate C, and programming in general. Good luck and I guess a free bump. You might want to try, maybe a Csharp forum too tho?
 
Damn I hate C, and programming in general. Good luck and I guess a free bump. You might want to try, maybe a Csharp forum too tho?
 
lol I know VB but with most Obj Oriented Languages thinking of it conceptually first makes it easy to write the actual code.

Just gotta make sure you're declaring everything correctly usually thats where the issue lies.
 
lol I know VB but with most Obj Oriented Languages thinking of it conceptually first makes it easy to write the actual code.

Just gotta make sure you're declaring everything correctly usually thats where the issue lies.
 
Originally Posted by LuckyLuchiano

Originally Posted by omgitswes

C# is like Java right?

all that stuff is the same just diff syntax.
That and classes in C can inherit from multiple classes, versus Java where you have to utilize interfaces to make a class inherit functionality from more than one class. Plus a few other key things.
 
Originally Posted by LuckyLuchiano

Originally Posted by omgitswes

C# is like Java right?

all that stuff is the same just diff syntax.
That and classes in C can inherit from multiple classes, versus Java where you have to utilize interfaces to make a class inherit functionality from more than one class. Plus a few other key things.
 
interesting. I hated Java with a passion, so never bothered with C# because my prof said it's pretty much the same.

Still need to teach myself Python whenever I get enough free time
 
interesting. I hated Java with a passion, so never bothered with C# because my prof said it's pretty much the same.

Still need to teach myself Python whenever I get enough free time
 
I downloaded the Android SDK and Eclipse weeks ago saying I would teach myself Java...........smh still havent done it.
 
I downloaded the Android SDK and Eclipse weeks ago saying I would teach myself Java...........smh still havent done it.
 
Comp Sci is a pain in the +@#... Really interesting stuff though
 
Comp Sci is a pain in the +@#... Really interesting stuff though
 
I can't remember C# (or Java for that matters), but let me take a shot at it in PHP, all you got to do is translate
wink.gif


Just to be sure, you want to know how much 5! does for example? This is how I would do it, in PHP again

function factorial($number){


$result = 1
if($number < 0){ // Only works with positive number;

$result = -1; // Use -1 to display an error message or something

}elseif($number == 0){

$result = 1;

}else{

for($i = $number; $i < 1; $i--){ // We will stop decreasing at 1, because we already included the *1 on the first occurence

$result = $result * $i;

}

}

return $result;

}
This should work, yes, SHOULD, i didn't take time to proofread
 
I can't remember C# (or Java for that matters), but let me take a shot at it in PHP, all you got to do is translate
wink.gif


Just to be sure, you want to know how much 5! does for example? This is how I would do it, in PHP again

function factorial($number){


$result = 1
if($number < 0){ // Only works with positive number;

$result = -1; // Use -1 to display an error message or something

}elseif($number == 0){

$result = 1;

}else{

for($i = $number; $i < 1; $i--){ // We will stop decreasing at 1, because we already included the *1 on the first occurence

$result = $result * $i;

}

}

return $result;

}
This should work, yes, SHOULD, i didn't take time to proofread
 
Originally Posted by ebpo

I can't remember C# (or Java for that matters), but let me take a shot at it in PHP, all you got to do is translate
wink.gif


Just to be sure, you want to know how much 5! does for example? This is how I would do it, in PHP again

function factorial($number){


$result = 1
if($number < 0){ // Only works with positive number;

$result = -1; // Use -1 to display an error message or something

}elseif($number == 0){

$result = 1;

}else{

for($i = $number; $i < 1; $i--){ // We will stop decreasing at 1, because we already included the *1 on the first occurence

$result = $result * $i;

}

}

return $result;

}
This should work, yes, SHOULD, i didn't take time to proofread



Another way which would b a little simpler:

Function factorial(number){

     loop until number = 1{                                     //Create a loop that runs until the number equals 1 since you do not need to multiply by 1
          ((number) * (number--)) == baseresult      
          baseresult + result == result
     }
return(result)

I know its not properly designed and none of the variables declared but u should get the jist of the algorithm
 
Back
Top Bottom