-
Notifications
You must be signed in to change notification settings - Fork 0
/
methods.txt
53 lines (48 loc) · 802 Bytes
/
methods.txt
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
43
44
45
46
47
48
49
50
51
52
53
#include <cstdlib>
using namespace std;
void compute1(int a, int b){
if (a>b){
for(int i=0; i<b;i++)
a=b/2-1;
}
else{
b = 2*a;
}
}
void compute2(int *a, int *b){
int temp = *a;
if(temp>0){
for (int i =0;i<temp;i++){
*a= *a+1;
}
*a=*a/2;
}
else if(*b>0 && *a>0){
*b=*b+*a;
}
}
int compute3(int a, int b){
for (int i=b;i>0;i--)
a= a+1;
return a;
}
int compute4(int a, int b){
int temp = a;
if(temp>0){
for (int i =0;i<temp;i++){
a= a+1;
}
a=a/2;
}
else if(b>0 && a>0){
b=b+a;
}
}
int compute5(int *a, int *b){
while(a==b){
*a=*a+*b+1;
if (*a>10)
return *b;
}
return *b;
}