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.
Var a:array[1..20] of integer;
i,n,d:integer;
Begin
For i:=1 to 20 do
Begin
Write('Nhap phan tu thu ',i);readln(a[i]);
if a[i] = 3 then d:=d+1;
End;
Write('Co ',d,' chu so 3');
Readln
End.
Program HOC24;
var a: array[1..32000] of integer;
i,n,d: integer;
begin
write('Nhap N: ');
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
write('Day vua nhap la: ');
for i:=1 to n do write(a[i],' '); writeln;
d:=0;
for i:=1 to n do if a[i]>0 then d:=d+1;
write('Co ',d,' so duong');
readln
end.
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n,A[100],dem,t;
cin>>n;
for (int i=1; i<=n; i++)
cin>>A[i];
dem=0; t=0;
for (int i=1; i<=n; i++)
if (A[i]%2==0) dem++;
else t+=A[i];
cout<<dem<<endl;
cout<<t;
return 0;
}
Câu 3:
Var i,n:integer:
Begin
Write('n = ');readln(n);
Write('Cac uoc cua n la ');
For i:=1 to n do
If n mod i = 0 then write(i:8);
Readln
End.
Câu 4
Var i,n:integer:
Begin
Write('n = ');readln(n);
Write('Cac so le nho hon n la ');
For i:=1 to n - 1 do
If i mod 2 <> 0 then write(i:8);
Readln
End.
#include <bits/stdc++.h>
using namespace std;
int main()
{
long long n,dem=0,s=0;
cin >> n;
for (long long i=1;i<=n;i+=2){
dem++;
s+=i;
}
cout << "tu 0 den n co: " << dem << " so le" << endl;
cout << "tong cac so le do la: " << s;
return 0;
#include <bits/stdc++.h>
using namespace std;
int main()
{
long long n,dem=0,s=0;
cin >> n;
for (long long i=1;i<=n;i+=2){
dem++;
s+=i;
}
cout << "tu 0 den n co: " << dem << " so le" << endl;
cout << "tong cac so le do la: " << s;
return 0;
}
var i,n,d:integer;
s:longint;
begin
write('n = ');readln(n);
for i:=1 to n do
if i mod 2 <> 0 then
begin
d:=d+1;
s:=s+i;
end;
writeln('co ',d,' so le');
write('tong cac so le la ',s);
readln;
end.
Câu 4:
uses crt;
var a:array[1..100]of integer;
i,n,dem,t:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
dem:=0;
t:=0;
for i:=1 to n do
if (10<a[i]) and (a[i]<20) then
begin
inc(dem);
t:=t+a[i];
end;
writeln('So phan tu lon hon 10 va nho hon 20 la: ',dem);
writeln('Tong cac phan tu lon hon 10 va nho hon 20 la: ',t);
readln;
end.
Câu 5:
uses crt;
var a:array[1..100]of integer;
i,n,dem,t:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
dem:=0;
t:=0;
for i:=1 to n do
if a[i] mod 2=0 then
begin
inc(dem);
t:=t+a[i];
end;
writeln('So so chan la: ',dem);
writeln('Tong cac so chan la: ',t);
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.
uses crt;
var x,n,i,dem:integer;
begin
clrscr;
write('n='); readln(n);
dem:=0;
for i:=1 to n do
begin
write('x='); readln(x);
if x mod 2=1 then inc(dem);
end;
writeln('so gia tri x le la: ',dem);
readln;
end.