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.
#include <bits/stdc++.h>
using namespace std;
long long a[20],n,i,dem;
int main()
{
for (i=1; i<=20; i++) cin>>a[i];
dem=0;
for (i=1; i<=20; i++)
if (a[i]%2!=0) dem++;
cout<<dem;
return 0;
}
uses crt;
var a:array[1..100]of integer;
i,n:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
for i:=1 to n do
if a[i] mod 2<>0 then write(a[i]:4);
readln;
end.
uses crt;
var i,n: integer;
a: array[1..10000] of integer;
begin
writeln('nhap so nguyen n: '); readln(n);
for i:=1 to n do
begin
writeln('A[',i,']'); readln(a[i]);
if i mod 2 <>0 then writeln(i);
end;
readln;
end.
1. Uses crt;
var n,i: integer;
begin clrscr;
readln(n);
for i:=1 to n do write(i:3);
readln;
end.
2. Uses crt;
var n,i: integer;
begin clrscr;
readln(n);
for i:=1 to n do if(i mod 2 = 0) then write(i:3);
readln;
end.
a)
uses crt;
var i,n:integer;
begin
clrscr;
repeat
write('Nhap n='); readln(n);
until n<100;
if n mod 2=0 then
begin
for i:=0 to n do
if i mod 2=0 then write(i:4);
end
else writeln(n,' khong la so chan');
readln;
end.
b)
uses crt;
var i,n:integer;
begin
clrscr;
repeat
write('Nhap n='); readln(n);
until n<100;
if n mod 2=1 then
begin
for i:=1 to n do
if i mod 2=1 then write(i:4);
end
else writeln(n,' khong la so le');
readln;
end.
Uses crt;
var n,i: integer;
begin clrscr;
readln(n);
for i:=1 to n do if (n mod 2<>0) then
write(i:2);
readln;
end.
1:
uses crt;
var t,x,i,n:integer;
begin
clrscr;
t:=0;
n:=10;
for i:=1 to n do
begin
readln(x);
t:=t+x;
end;
write(t);
readln;
end.
2:
uses crt;
var dem,x,i,n:integer;
begin
clrscr;
dem:=0;
n:=10;
for i:=1 to n do
begin
readln(x);
if x mod 2=0 then inc(dem);
end;
write(dem);
readln;
end.
3
program Cacsole;
uses crt;
var M, N, i: integer;
begin
clrscr;
write ('Nhap M= '); readln(M);
write ('Nhap N= '); readln(N);
for i := M to N do
if i mod 2 = 1 then
write (i,' ');
readln;
end.
Câu 1:
Program HOC24;
var i,p: integer;
t: longint;
begin
write('Nhap P: '); readln(p);
t:=0;
for i:=1 to p do if i mod 2<>0 then t:=t+i;
write('Tong cac so le la: ',t);
readln
end.
program PrintEvenOdd;
var
num, even, odd, i: Integer;
begin
even := 0;
odd := 0;
for i := 1 to 5 do
begin
writeln('Nhap so thu ', i, ': ');
readln(num);
if num mod 2 = 0 then
even := even + 1
else
odd := odd + 1;
end;
writeln('Tong chan: ', even);
writeln('Tong le: ', odd);
end.
Var a:array[1..5] of integer;
i:integer;
Begin
For i:=1 to 5 do
Begin
Write('Nhap so thu ',i,' = ');readln(a[i]);
End;
Writeln('Cac so chan la ');
For i:=1 to 5 do
If a[i] mod 2 = 0 then write(a[i]:8);
Writeln;
Write('Cac so le la ');
For i:=1 to 5 do
If a[i] mod 2 <> 0 then write(a[i]:8);
Readln
End.
c1:
#include <bits/stdc++.h>
using namespace std;
long long i,n,s;
int main()
{
cin>>n;
s=1;
for (i=1; i<=n; i++) s=s*i;
cout<<s;
return 0;
}
Câu 2:
#include <bits/stdc++.h>
using namespace std;
long long i,n,s;
int main()
{
cin>>n;
s=1;
for (i=1; i<=n; i++) if (i%2==0) s=s*i;
cout<<s;
return 0;
}
Program HOC24;
var a: array[1..1000] of integer;
i,n: integer;
begin
write('Nhap n: '); readln(n);
for i:=1 to n do
begin
write('Nhap so thu :',i,': '); readln(a[i]);
end;
write('Cac so le la: ');
for i:=1 to n do if a[i] mod 2=0 then write(a[i],' ');
readln
end.
#Python:
n = int(input())
for i in range(1, n + 1):
if i % 2 != 0:
print(i)