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 i, fact=1, n; |
cout<<"n="; | cout<<"n="; | ||
cin>>n; | cin>>n; | ||
− | + | for(i=1;i<=n;i++){ | |
− | + | fact=fact*i; | |
− | + | ||
} | } | ||
+ | cout<<fact; |
Revision as of 04:00, 16 January 2020
- 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;