G. Factorial – Codeforces Problem Solution in C++

Disclaimer: Make sure you tried enough before checking the solution

Problem: https://codeforces.com/group/MWSDmqGsZm/contest/219432/problem/G

#include<bits/stdc++.h>
using namespace std;
int main()
{
	int counter;
	cin>>counter;
	long long fac = 1; 
	while(counter--){
		int num;
		cin>>num; 
		for(int i=1;i<=num;i++){ 
			fac *= i;
		}
		cout<<fac<<endl;
		fac = 1;
	}
}

Assiut University Training – Newcomers solution

Leave a Comment