Skip to content
Snippets Groups Projects
Commit 44b2c81e authored by Viviane Pons's avatar Viviane Pons
Browse files

Ajout exos Wims

parent 2ea7aa9f
No related branches found
No related tags found
No related merge requests found
#include <iostream>
using namespace std;
int max(int x, int y) {
if(x > y) {
return x;
}
return y;
}
int blackJack(int x, int y) {
if(x > 21) {
if(y > 21) {
return 0;
}
return y;
}
if (y > 21) {
return x;
}
return max(x,y);
}
int main() {
int x,y;
x = 15;
y = 22;
cout << max(x,y) << endl;
cout << blackJack(x,y) << endl;
x = 12;
y = 17;
cout << max(x,y) << endl;
cout << blackJack(x,y) << endl;
x = 23;
y = 25;
cout << max(x,y) << endl;
cout << blackJack(x,y) << endl;
}
#include <iostream>
using namespace std;
int main() {
int i = 1;
while(i < 11) {
cout << i << endl;
i = i * 2;
}
}
#include <iostream>
using namespace std;
int main() {
int i = 0;
while(i < 11) {
cout << i << endl;
i = i + 2;
}
}
#include <iostream>
using namespace std;
int main() {
int i = 6;
while(i!=1) {
cout << i << endl;
if(i%2==1) {
i = 3*i + 1;
} else {
i = i/2;
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment