Getting wrong answer

#include
using namespace std;
int main(){
int t;
cin>>t;
for(int i=0;i<t;i++){
int a;
cin>>a;
int r=1;
while(a>0){
r=r*a;
a=a-1;
}
cout<<r<<endl;
}
return 0;
}

You may use a while loop in line 6 instead of a for loop ( like - while(t–) ). sometimes for loop gives unexpected answer . but your logic is correct :+1:.
Hope i have solved your problem :slight_smile: