-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmaxNum.c
More file actions
81 lines (47 loc) · 1.08 KB
/
maxNum.c
File metadata and controls
81 lines (47 loc) · 1.08 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
66
#include <stdio.h>
// int main(){
// int n1,n2;
// printf("Enter two numbers: ");
// scanf("%d %d", &n1, &n2);
// printf("%d", max(n1,n2));
// }
// int max(int a, int b){
// if(a<b) return b;
// return a;
// }
// #include <stdio.h>
// int main() {
// int n1, n2;
// int max(int, int);
// printf("Enter two whole numbers: ");
// scanf("%d %d", &n1, &n2);
// while (n1 != 0 || n2 != 0) {
// printf("The bigger is %d\n", max(n1, n2));
// printf("Enter two whole numbers: ");
// scanf("%d %d", &n1, &n2);
// }
// } //end main
// int max(int a, int b) {
// if (a > b) return a;
// return b;
// }
int main(){
int n1,n2;
int HCF(int, int);
printf("Enter two numbers: ");
scanf("%d %d", &n1, &n2);
do{
printf("\nHCF of %d %d is %d \n",n1, n2, HCF(n1,n2));
printf("\n Enter two numbers: ");
scanf("%d %d", &n1, &n2);
}while(n1 != 0 || n2 != 0);
}
int HCF(int m, int n){
int r;
do{
r = m %n;
m = n;
n = r;
}while(n !=0);
return m;
}