can someone explain how it detected wrong asnwer, even the input and output are correct
#include <stdio.h>
int main(){
int t, n;
scanf("%d", &t);
int i, sum=1;
if(t>=1 && t<=100){
for(i=0;i<t;i++){
scanf("%d", &n);
if(n>=1 && n<=100){
while(n>0){
sum=sum*n;
n--;
}
printf("%d\n", sum);
sum=1;
}
else{
return 0;
}
}
return 0;
}
else{
return 0;
}
}
[quote=“mys73r10us, post:1, topic:93276”]
#include <stdio.h>
int main(){
int t, n;
scanf("%d", &t);
int i, sum=1;
if(t>=1 && t<=100){
for(i=0;i<t;i++){
scanf("%d", &n);
if(n>=1 && n<=100){
while(n>0){
sum=sum*n;
n--;
}
printf("%d\n", sum);
sum=1;
}
else{
return 0;
}
}
return 0;
}
}
still get the wrong asnwer
yuxdi
4
#include<bits/stdc++.h>
#include<boost/multiprecision/cpp_int.hpp>
using namespace std;
using namespace boost :: multiprecision;
int main(){
int t;
cin>>t;
for (int i = 0; i < t; i++)
{
int n;
cin>>n;
cpp_int fact = 1;
for (int i = 2; i <= n; i++)
{
fact*=i;
}
cout<<fact<<endl;
}
return 0;
}