Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int main(){
- int in, tc;
- cin >> tc;
- while(tc--){
- int m=0, idx, temp, rem, i=0;
- int res[200];
- cin >> in;
- temp = in;
- while(temp){
- rem = temp%10;
- res[i] = rem;
- temp/=10;
- i++;
- m++;
- }
- for(i=2;i<in;i++){
- temp = 0;
- for(idx=0;idx<m;idx++){
- temp = res[idx]*i + temp;
- res[idx] = temp%10;
- temp/=10;
- }
- while(temp){
- res[idx]=temp%10;
- temp/=10;
- idx++;
- m++;
- }
- }
- cout << ">";
- for(i=m-1;i>=0;i--){
- cout << res[i];
- }
- cout << endl;
- }
- }
Add Comment
Please, Sign In to add comment