Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <math.h>
- using namespace std;
- int ile;
- float a,b;
- unsigned long long int potega(int podstawa, int wykladnik)
- {
- if(wykladnik==0) return 1;
- else return potega(podstawa,wykladnik-1)*podstawa;
- }
- int main()
- {
- cin >> ile;
- for(int i=0; i<ile; i++)
- {
- cin>>a>>b;
- cout<<potega(a,b)<<endl;
- }
- return 0;
- }
- =====================================================
- #include <iostream>
- using namespace std;
- int ile;
- float a,b;
- long long int potega(int podstawa, int wykladnik)
- {
- long long int wynik = 1;
- for (int i = 0; i<wykladnik; i++)
- wynik*=podstawa;
- return wynik;
- }
- int main()
- {
- cin >> ile;
- for(int i=0; i<ile; i++)
- {
- cin>>a>>b;
- cout<<(potega(a,b))%10<<endl;
- }
- return 0;
- }
- =============================================================
- #include <iostream>
- #include <math.h>
- using namespace std;
- int ile;
- float a,b;
- int main()
- {
- cin >> ile;
- for(int i=0; i<ile; i++)
- {
- cin>>a>>b;
- double c;
- c=pow(a,b);
- cout<<(int)c%10<<endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement