Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <iostream>
- #include <sstream>
- #include <string>
- using namespace std;
- int silnia(int n)
- {
- if (n == 0) return 1;
- else return silnia(n - 1)*n;
- }
- int main()
- {
- int proby;
- cin >> proby;
- for (int i = 0; i < proby; i++)
- {
- int n;
- ostringstream liczba;
- cin >> n;
- liczba << silnia(n);
- string liczba2 = liczba.str();
- int dlugosc = liczba2.length();
- if (dlugosc < 2)
- cout << "0"<<" "<< liczba2[dlugosc - 1] << endl;
- else cout << liczba2[dlugosc - 2] << " " << liczba2[dlugosc - 1] << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement