forked from BitsPleaseMSI/BitsPlease-solutions
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path28.cpp
More file actions
36 lines (33 loc) · 630 Bytes
/
Copy path28.cpp
File metadata and controls
36 lines (33 loc) · 630 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include<iostream>
#include<conio.h>
using namespace std;
int main()
{
/*
* Integer 'n' is declared for number of inputs
* arr is a pointer which is used to create dynamic array
* 'a' and 'b' are used to input numbers
* temp is used for processing of data
*/
int n, *arr, a, b, temp;
cin >> n;
arr = new int[n];
for (int i = 0; i < n; i++)
{
cin >> a >> b;
temp = 1;
while (b > 0)
{
temp = temp * a;
temp = temp % 10; // Since we only need the last digit
b--;
}
arr[i] = temp;
}
cout << "\n\n";
for (int i = 0; i < n; i++)
cout << "\n" << arr[i];
getch();
delete[] arr;
return 0;
}