Hãy nhập câu hỏi của bạn vào đây, nếu là tài khoản VIP, bạn sẽ được ưu tiên trả lời.

mình chưa hiểu rõ đề lắm nên mình sẽ làm tạm như thế này còn nếu bạn muốn kiểu khác thì cứ bình luận để mình làm lại.
câu 1 :
#include<iostream>
using namespace std;
int main() {
long long a;
cout << "giá trị của a: "; cin >> a;
if (a % 2 != 0 && a % 5 == 0) {
cout << "a là một số lẻ chia hết cho 5"
} else {
cout << "a không phải là một số lẻ chia hết cho 5";
}
return 0;
}
câu 2 :
#include<iostream>
using namespace std;
int main() {
int a;
cout << "giá trị của a là: "; cin >> a;
if (a % 2 == 0 && a % 5 == 0) {
cout << "a là một số chẵn chia hết cho 5";
} else {
cout << "a không phải là một số chẵn chia hết cho 5";
}
return 0;
}
(Mình viết ở ngôn ngữ C++)

a: Input: Số a
Output: Kiểm tra xem a là số chẵn hay lẻ
b:
Bước 1: Nhập a
Bước 2: Nếu a chia hết cho 2 thì xuất a là số chẵn
không thì a là số lẻ
Bước 3: Kết thúc
c:
uses crt;
var a:integer;
begin
clrscr;
readln(a);
if a mod 2=0 then write('a la so chan')
else write('a la so le');
readln;
end.

program mang;
uses crt;
var n,i,chan, le,max,min: Integer;
a:array[1..100] of integer;
begin
write('nhap so phan tu ');read(n);
for i:=1 to n do
begin
write('nhap so thu ',i); readln(a[i]);
end;
max:=a[1]; min:=a[1]; chan:=0;le:=0;
for i:=1to n do
begin
if a[i] > max then max:=a[i];
if a[i] < min then min:=a[i];
if a[i] mod 2 = 0 then chan:=chan+1
else le:=le+1;
end;
writeln('max la: ',max);
writeln('min la: ',min);
writeln('so phan tu chan: ',chan);
writeln('so phan tu le: ',le);
readln
end.

Câu 1:
program Tinhtong:
var
n, i, sum: integer;
begin
write('Nhap n: ');
readln(n);
sum := 0;
for i := 2 to n do
begin
if i mod 2 = 0 then
begin
sum := sum + i;
end;
end;
writeln('Tong cac so chan tu 2 toi ', n, ' la ', sum);
readln;
end.
Câu 2:
program Tinhtong:
var
n, i, sum: integer;
begin
write('Nhap n: ');
readln(n);
sum := 0;
for i := 1 to n do
begin
if i mod 2 = 1 then
begin
sum := sum + i;
end;
end;
writeln('Tong cac so le tu 1 toi ', n, ' la ', sum);
readln;
end.

#include <bits/stdc++.h>
using namespace std;
long long a[1000],n,i;
int main()
{
cin>>n;
for (i=1; i<=n; i++)
cin>>a[i];
cout<<"Cac so le la: "<<endl;
for (i=1; i<=n; i++) if (a[i]%2!=0) cout<<a[i]<<" ";
cout<<endl;
cout<<"Cac so chan la: "<<endl;
for (i=1; i<=n; i++) if (a[i]%2==0) cout<<a[i]<<" ";
return 0;
}
n = int(input("Nhập vào giá trị của n: "))
even_count = 0
odd_count = 0
for i in range(1, n+1):
if i % 2 == 0:
even_count += 1
else:
odd_count += 1
print("Số chẵn trong dãy là:", even_count)
print("Số lẻ trong dãy là:", odd_count)

uses crt;
var i,n,t:integer;
begin
clrscr;
write('nhap n='); readln(n);
t:=0;
for i:=1 to n do
if i mod 2=0 then t:=t+i;
writeln(t);
readln;
end.

uses crt;
var i,n,t:integer;
begin
clrscr;
write('nhap n='); readln(n);
t:=0;
for i:=1 to n do
if i mod 2=1 then t:=t+i;
writeln(t);
readln;
end.
Lỗi chưa đặt điều kiện cho n.