Please Programmars Help Me Out With This C# Program! I Have Test Tommorrow!!!!! - Programming - Nairaland
Nairaland Forum › Science/Technology › Programming › Please Programmars Help Me Out With This C# Program! I Have Test Tommorrow!!!!! (1582 Views)
| Please Programmars Help Me Out With This C# Program! I Have Test Tommorrow!!!!! by Aplaudez(op): 10:12am On Feb 03, 2016 |
A c# program to find the factorial of an integer value given from the console! please guys help me out! |
| Re: Please Programmars Help Me Out With This C# Program! I Have Test Tommorrow!!!!! by Nobody: 10:27am On Feb 03, 2016 |
| Re: Please Programmars Help Me Out With This C# Program! I Have Test Tommorrow!!!!! by Nobody: 6:52pm On Feb 04, 2016 |
In Java using Recursion
|
| Re: Please Programmars Help Me Out With This C# Program! I Have Test Tommorrow!!!!! by Nobody: 2:39am On Feb 05, 2016 |
Aplaudez:Saw the post a little bit too late. |
| Re: Please Programmars Help Me Out With This C# Program! I Have Test Tommorrow!!!!! by Sirnuel: 9:11am On Feb 05, 2016 |
//in C++, using recursion; #include <iostream> int factorial (int x); //function prototype using namespace std; int main (){ int x; int fact; cout << "\nEnter a positive integer: \t"; cin >> x; fact = factorial(x); cout << "The factorial of " << x << " is " << fact; return 0; } //function definition; int factorial (int x){ if(x == 1) {return 1;} else {return x*factorial(x-1);} } //in C++, using iteration; #include <iostream> using namespace std; int main (){ int x; int fact = 1; cout << "\nEnter a positive integer: \t"; cin >> x; cout << "The factorial of " << x << " is "; //forever loop for(; {if (x == 1){ break; } else { fact = fact * x; x--; } } cout << fact << endl; return 0; } |
Please Guys Help Me With This C++ Program Exam Question. It's Urgent. • Fix This C++ Code If You can • Help! Im Stuck With This C# Program • 2 • 3 • 4
Coding From Scratch Or Using Bootstrap, which way? • Java Programmer Needs Help • The Importance Of Github To A Programmer
{