Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,151,607 members, 7,812,998 topics. Date: Tuesday, 30 April 2024 at 02:51 AM

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!!!!! (1442 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)

(1) (Reply) (Go Down)

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


public static int factorial(int value){
if(value<=1){
return 1;
}else{
return value * factorial(value -1);
}
}

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:
A c# program to find the factorial of an integer value given from the console! please guys help me out!

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(; wink{

if (x == 1){
break;
}

else {
fact = fact * x;
x--;
}
}

cout << fact << endl;

return 0;
}

1 Like

(1) (Reply)

I Need A Work Solution On Pythons Question Attached Here. / How Do I Introduce An 8 Year Old Boy To Programming / Lawpavilion Unveils Nigeria’s First Artificial Intelligence Legal Assistant

(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. 9
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.