-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAnotherTwoIntegersProblem.c
More file actions
42 lines (41 loc) · 922 Bytes
/
AnotherTwoIntegersProblem.c
File metadata and controls
42 lines (41 loc) · 922 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
36
37
38
39
40
41
42
#include <stdio.h>
int main()
{
int a, b, t;
scanf("%d", &t);
while(t--)
{
scanf("%d %d", &a, &b);
if (a == b)
{
printf("%d\n", 0);
}
else if (b > a)
{
int x = b - a;
if (x < 10)
printf("%d\n", 1);
else if (x >= 10)
{
if (x % 10 == 0)
printf("%d\n", x / 10);
else if (x % 10 != 0)
printf("%d\n", (x / 10) + 1);
}
}
else if (a > b)
{
int y = a - b;
if (y < 10)
printf("%d\n", 1);
else if (y >= 10)
{
if (y % 10 == 0)
printf("%d\n", y / 10);
else if (y % 10 != 0)
printf("%d\n", (y / 10) + 1);
}
}
}
return 0;
}