Hi
I was simply experimenting with the C++. I declared the factorial with two long's in the below code. It compiled fine and worked fine. Are double, treble, and so on declarations allowed? Please guide me. Thanks.
Code:// finding factorial of n #include <iostream> #include <cstdlib> using namespace std; int main() { long long factorial=1; int n, i; cout << "Enter the number you want factorial of: "; cin >> n; for (i=n; i>=1; i--) { factorial = factorial * i; } cout << "Factorial of entered number is: " << factorial << endl; system("pause"); }



LinkBack URL
About LinkBacks



