Tuesday, October 29
Fatorial using Do While loops
In mathematics, the factorial of a non-negative integer n, denoted by n!, is the product of all positive integers less than or equal to n. For example,
(for more info visit Factorial on Wiki )
Code:
you might write something in C#
(for more info visit Factorial on Wiki )
Code:
you might write something in C#
#includeusing namespace std; int main() { int factorial = 1, value = 1; cout << "Please enter value to find its factorial" << endl; cin >> value; int temporary = value; if (value < 0) { cout << "please enter a positive number "; main(); } else if (value<2) { cout << "factorial of " << value << " is " << 1 << endl; } else { do { factorial *= temporary--; } while (temporary>1); cout << "factorial of " << value << " is " << factorial << endl; return 0; } }
Kindly click november 2013 in blog archive and we have great posts for you there. (y)
ReplyDeletei need help with functions as well - Anand
ReplyDeleteI shall make a post very soon, inshaALLAAH :)
ReplyDeleteSir I need help with Functions ,,,,,
ReplyDeleteA line by line explanation
ReplyDeleteI think this has been done mate ;)
ReplyDeletethe code needs to be properly written, possibly use syntaxhighlighter or google pretty it up thingy :)
ReplyDelete