Menu
Menu
DaniWeb
Log In
Sign Up
Read
Contribute
Meet
Search
Search
About 1,000 results for
factorial
- Page 1
Re: Factorial Help
Programming
Software Development
12 Years Ago
by sirlink99
… down. So I wanted to keep the
factorial
method the same as what a
factorial
is, but it doesn't actually matter…
Re: Factorial Help
Programming
Software Development
12 Years Ago
by sharat90
you can also use recursion. [CODE]public int
factorial
(int n) { if((n == 0) || (n == 1)) return 1; else return n *
factorial
(n-1); } [/CODE]
Factorial Help
Programming
Software Development
12 Years Ago
by xiangzhuang
Hey guys, I have this HW for school for Java but I just can't seem to figure it out. I know I have to use a for loop for it but I just can't seem to figure out everything else. Thanks :D public int
factorial
(int n) { }
Re: Factorial Help
Programming
Software Development
12 Years Ago
by sirlink99
no. instead of adding you want to subtract. and the n is the
factorial
(in your case 7, so 7 x 6 x 5 x 4 x 3 x 2 x 1). so you want to use n in your for loop. and you want to decrement to follow the pattern. then your fact value if your answer, so the operation would look like this [CODE] fact = fact * n; [/CODE]
Re: Factorial Help
Programming
Software Development
12 Years Ago
by JamesCherrill
… adding you want to subtract. and the n is the
factorial
(in your case 7, so 7 x 6 x 5…
Re: Factorial Help
Programming
Software Development
12 Years Ago
by carlosreg
for(int i=o;i<=n;i++) { fact=fact*i; } take two variables for one for
factorial
and another for int initialize them u will get the ans
Re: Factorial
Programming
Software Development
13 Years Ago
by dipesh shrestha
[CODE]#include<stdio.h> int
factorial
(int); int main() { int n,f; printf("enter n\n"); scanf("%d",&n); f=
factorial
(int n); printf("the
factorial
of %d is %d\n",n,f); return 0; } int
factorial
(int n); { f=n*
factorial
(n-1); return f; }[/CODE]
Factorial
Programming
Software Development
13 Years Ago
by farhanafzal
Write a C program to find and print the product of
factorial
of numbers from N to M. Can anyone please give me an idea, how to solve this Question ? Thank you.
Re: Factorial
Programming
Software Development
13 Years Ago
by Narue
Start by learning how to calculate a
factorial
. Then translate that to code. Finally, do that on every value from N to M. Seriously, have you tried [I]anything[/I] yet?
Re: Factorial
Programming
Software Development
13 Years Ago
by farhanafzal
… the m { for(j=1;j<=i;j++)// for
factorial
{ mult=mult*j; } mult=mult*j; } printf("Mult : %d…
Re: Factorial
Programming
Software Development
13 Years Ago
by abhimanipal
… { mult=1; for(j=1;j<=i;j++)// for
factorial
{ mult=mult*j; } mult1=mult1*mult; }[/CODE] PS: Avoid using…
Re: Factorial
Programming
Software Development
13 Years Ago
by dipesh shrestha
#include<stdio.h> int main() { int n,i,f=1; printf("enter n\n"); scanf("%d",&n); for(i=1;i<n;i++) { f*=n*i; } printf("the
factorial
of %d is %d",n,f); return 0; }
Re: Factorial
Programming
Software Development
13 Years Ago
by sannidhikumar99
[CODE]#include<stdio.h> #include<conio.h> void main() { int n,f; f=1; printf("Enter the number:\n"); scanf("%d",&n); while(n>0) { printf("%d",n); f=f*n; n--; } printf("The
factorial
of the integer is:%d",f); getch(); }[/CODE]
Re: Factorial
Programming
Software Development
13 Years Ago
by nbaztec
Yes, we all know that you all can Code
factorial
programs, but please don't give away your precious, one-…
Re: factorial function in a formula
Programming
Software Development
16 Years Ago
by vmanes
Factorial
function is really pretty easy - often used in any tutorial … using a loop is more efficient. Keep in mind that
factorial
grows very fast - depending on how many iterations your calculation… not be a suitable data type to return from your
factorial
function. And review your material on writing functions - you need…
Re: factorial using recursion
Programming
Software Development
11 Years Ago
by deceptikon
>
factorial
(x--,y*z,z++); You're passing the current value of x to
factorial
(), recursion never stops and you experience a stack overflow.
Factorial without recursion
Programming
Software Development
14 Years Ago
by Ajantis
Hey folks :) I was writing some code today, and I wrote a function for computing factorials without use of recursion. What do you think about this one? [CODE]int
factorial
(N) { int r; r = 0; while (N > 0) { r *= (n-1); n--; } return r; }[/CODE]
Factorial Calculation using VB.net
Programming
Software Development
12 Years Ago
by lili22
[B]Hello .. im a business student with a vb.net course .. donno why we're being taught vb but that's that .. any ways could anyone help me solve this problem: Develop an application which reads two integers n1 and n2 from the user via two textboxes and displays in a label the sum of the
factorial
of the integers n1 and n2[/B]
Factorial
Programming
Software Development
16 Years Ago
by Spagett912
… No input or output should happen inside of “
factorial
”, only the math operations and the returning of a…a parameter (using the stack) to your
factorial
function. Your
factorial
function should then return its answer via EAX.…i.e. EAX contains a “-1”) Or The
factorial
of “n” cannot be computed accurately because it’s…
Re: Factorial
Programming
Software Development
14 Years Ago
by nirav99
…include<conio.h> int x; class
factorial
{ public: void fact(); }; void
factorial
::fact() { clrscr(); int f=1; int…f=f*i; } cout<<endl<<"
Factorial
:-- "<<f; } void main() { clrscr(); …
Factorial Help
Programming
Software Development
16 Years Ago
by lostandconfuzed
…! = 40 3! = 30 2! = 20 1! = 10 The
factorial
of 10 is 3628800 Press any key to continue . . . ...and…iostream> using namespace std; int
factorial
(int); void main() { int x; int
factorial
=1; cout << &…<<" is "<<
factorial
<<endl; } int
factorial
(int n) { if (n <= 1…
Re: Factorial Help
Programming
Software Development
16 Years Ago
by lostandconfuzed
…re mixing up two different solutions for calculating a
factorial
. Just remove all of the manual stuff and …[code=cplusplus] #include<iostream> using namespace std; int
factorial
(int); int main() { int x; cout << … "!"<< " = " <<
factorial
(i) <<endl; } else cout << x &…
Factorial help
Programming
Software Development
14 Years Ago
by brich744
… #include <iostream> using namespace std; int
factorial
(int num) { if(num<=1) return 1;… else return num*
factorial
(num-1); } int computeWay(int n, int k)…return n; else if(n<k) return
factorial
(n)/(
factorial
(k) *
factorial
(x)); } int main() { int a; int…
Re: Factorial help
Programming
Software Development
14 Years Ago
by rOKi125
…gt; #include <iostream> using namespace std; int
factorial
(int num) { if(num<=1) return 1; …) return n; else if(n<k) return
factorial
(n)/(
factorial
(k) *
factorial
(x)); } int main() { int a; int b…
Re: Factorial Help
Programming
Software Development
16 Years Ago
by Narue
… mixing up two different solutions for calculating a
factorial
. Just remove all of the manual stuff and…code=cplusplus] #include<iostream> using namespace std; int
factorial
(int); int main() { int x; cout << …;< " = " <<
factorial
(i) <<endl; } } int
factorial
(int n) { if (n <= 1)…
Re: Factorial Help
Programming
Software Development
16 Years Ago
by Narue
… << "!"<< " = " <<
factorial
(i) <<endl; } else { cout << x <…
Re: Factorial
Programming
Software Development
14 Years Ago
by VernonDozier
…way of calculating [CODE]while ( i <= N ) {
factorial
= (N-i)*s; s = (N-i); i=i+…1; }[/CODE] I confused the
factorial
with the "s" which is the sum…actually name your "s" variable "
factorial
". It's more descriptive. There's no…
Re: Factorial
Programming
Software Development
14 Years Ago
by VernonDozier
… moot point, but I was thinking you would display the
factorial
variable inside the loop and see if it was changing… each time through the loop. Something like this: [code]
factorial
= 1
factorial
= 2
factorial
= 6
factorial
= 2[B]4[/B] [/code] If you weren…
Re: Factorial
Programming
Software Development
14 Years Ago
by new programer
… moot point, but I was thinking you would display the
factorial
variable inside the loop and see if it was changing… each time through the loop. Something like this: [code]
factorial
= 1
factorial
= 2
factorial
= 6
factorial
= 2[B]4[/B] [/code] If you weren…
Re: Factorial?
Programming
Software Development
21 Years Ago
by Dani
[code] int x,
factorial
= 1; cout << "Enter integer: "; …; while (x > 0) {
factorial
*= x; x--; } } cout << "…
1
2
3
17
Next
Last
Search
Search
Forum Categories
Hardware/Software
Programming
Digital Media
Community Center
Latest Content
Newest Topics
Latest Topics
Latest Posts
Latest Comments
Top Tags
Topics Feed
Social
Forums
Top Members
Meet People
Community Functions
DaniWeb Premium
Newsletter Archive
Markdown Syntax
Community Rules
Developer APIs
Connect API
Forum API Docs
Tools
SEO Backlink Checker
Legal
Terms of Service
Privacy Policy
FAQ
About Us
Advertise
Contact Us
© 2024 DaniWeb® LLC