-
Notifications
You must be signed in to change notification settings - Fork 0
/
exo_supp2.cpp
52 lines (36 loc) · 843 Bytes
/
exo_supp2.cpp
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
/**********************************************
Description: trouver automatiquement un nombre qui est esgale a 11 fois ces chiffres
by: BUNELIER Hugo | github bubudotsh
Created: 2022-09-30 18:45:43
Updated: 2022-09-30 18:58:56
************************************************/
#include <iostream>
#include <string>
using namespace std;
int main() {
int i = 1;
int a = 0;
int b = 0;
int nb = 0;
while (i != 99999) {
a = i;
b = i;
while (b != 0) {
a = a % 10;
b = b / 10;
nb = nb + a;
a = b;
}
if (nb * 11 == i) {
cout << "ok" << i;
return EXIT_SUCCESS;
}
nb = 0;
i++;
}
cout << nb *11 << endl;
cin.get(); cin.ignore();
return EXIT_SUCCESS;
}
/*
*/