In the Problem FCTRL2
for finding factorial of a num, i wrote the following code but this turned out to be wrong but in other compilers it’s giving right answer.
#include
using namespace std;
int main() {
int n;
int num;
cin>>n;
while(n–){
cin>>num;
int fact=1,i=1;
while(i<=num){
fact=fact*i;
i++;
}
cout<<fact<<endl;
}
return 0;
}