giúp tin 4

#include <iostream>
Hello Haideptrai,

Welcome to the forum. Be sure to read up on these:

PLEASE ALWAYS USE CODE TAGS (the <> formatting button) when posting code.
It makes it easier to read your code and also easier to respond to your post.
http://www.cplusplus.com/articles/jEywvCM9/
http://www.cplusplus.com/articles/z13hAqkS/
Hint: You can edit your post, highlight your code and press the <> formatting button.
You can use the preview button at the bottom to see how it looks.

That is a good start. What is your question?

Andy
Ex1:
#include<iostream>
using namespace std;

int main() {
int a, b, c;
cin >> a >> b >> c;
if (a >= b && a >= c) cout << a;
if (b >= a && b >= c) cout << b;
if (c >= b && c >= a) cout << c;
return 0;
}
#include<iostream>
using namespace std;

int main() {
int a, b, c;
cin >> a >> b >> c;
if ((a >= b && a <= c) || (a >= c && a <= b)) cout << a;
if ((b >= a && b <= c) || (b >= c && b <= a)) cout << b;
if ((c >= b && c <= a) || (c >= a && c <= b)) cout << c;
return 0;
}
#include<iostream>
using namespace std;

int main() {
int n;
cin >> n;
int a[n];
for (int i = 0; i < n; i++) {
cin >> a[i];
}
for (int i = n - 1; i >= 0; i--) {
cout << a[i]; (nếu cần thêm dấu " ")
}
return 0;
}
Ex4:
#include<iostream>
#include<cmath>
using namespace std;

int main() {
int n;
cin >> n;
int a[n];
for (int i = 0; i < n; i++) {
cin >> a[i];
}
int tongChan = 0;
int tongLe = 0;
for(int i = 0; i < n; i++) {
if (a[i] % 2 != 0) {
tongLe = tongLe + a[i];
}
}
for(int i = 0; i < n; i++) {
if (a[i] % 2 == 0) {
tongChan = tongChan + a[i];
}
}
cout << abs(tongLe - tongChan);
return 0;
}
làm xong xoá topic ko ăn report =)))
Topic archived. No new replies allowed.