Variants
Views
Actions

Difference between revisions of "Cppreference:Archives"

From cppreference.com
Line 1: Line 1:
 
 
 
 
#include <iostream>
 
#include <iostream>
 
 
using namespace std;
 
using namespace std;
 
+
int main()
int main(){
+
{
int n; int sum;
+
int i, fact=1, n;
 
cout<<"n=";
 
cout<<"n=";
 
cin>>n;
 
cin>>n;
sum=n*(n-1);
+
for(i=1;i<=n;i++){
cout<<sum;
+
fact=fact*i;
return 0;
+
 
}
 
}
 +
cout<<fact;

Revision as of 04:00, 16 January 2020

  1. include <iostream>

using namespace std; int main() { int i, fact=1, n; cout<<"n="; cin>>n; for(i=1;i<=n;i++){ fact=fact*i; } cout<<fact;