Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,179,265 members, 7,907,532 topics. Date: Thursday, 01 August 2024 at 11:25 AM |
Nairaland Forum / Science/Technology / Programming / Please Programmars Help Me Out With This C# Program! I Have Test Tommorrow!!!!! (1471 Views)
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)
Please Programmars Help Me Out With This C# Program! I Have Test Tommorrow!!!!! by Aplaudez(m): 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
1 Like |
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; } 1 Like |
(1) (Reply)
Please How Do I Recreate This Design / ### HOT ### Get Free Software To Increase You Feedburner Subscribers / Sakososms.com Help Me Test-drive It
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 14 |