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.
#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;
}
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.
Bài 3:
#include <bits/stdc++.h>
using namespace std;
long long a,b;
int main()
{
cin>>a>>b;
cout<<a%b;
cout<<a/b;
return 0;
}
uses crt;
var a:array[1..100]of integer;
i,n,dem:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
dem:=0;
for i:=1 to n do
if (10<a[i]) and (a[i]<20) then inc(dem);
writeln(dem);
readln;
end.
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.
program timtich;
uses crt;
var i,n:integer;
tich:longint;
a:array[1..100]of integer;
begin
clrscr;
write('nhap so n:');readln(n);
for i:=1 to n do
begin
write('nhap phan tu a[',i,']:');readln(a[i]);
end;
for i:=1 to n do
write(a[i]:4);
tich:=1;
writeln;
for i:=1 to n do
if a[i] mod 2=0 then tich:=tich*a[i];
writeln('tich ca phan tu chan cua mang la:',tich);
readln;
end.
program timtong;
uses crt;
var i,n:integer;
tong:longint;
a:array[1..100]of integer;
begin
clrscr;
write('nhap so n:');readln(n);
for i:=1 to n do
begin
write('nhap phan tu a[',i,']:');readln(a[i]);
end;
for i:=1 to n do
write(a[i]:4);
tong:=0;
writeln;
for i:=1 to n do
if a[i] mod 2=0 then tong:=tong+a[i];
writeln('tong cac phan tu chan cua mang la:',tong);
tong:=0;
writeln;
for i:=1 to n do
if a[i] mod 2=1 then tong:=tong+a[i];
writeln('tong cac phan tu le cua mang la:',tong);
readln;
end.
Bài 1:
uses crt;
var a:array[1..100]of integer;
i,n,s:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
s:=1;
for i:=1 to n do
if a[i] mod 2=0 then s:=s*a[i];
writeln(s);
readln;
end.
2:
#include <bits/stdc++.h>
using namespace std;
long long a,b;
int main()
{
cin>>a>>b;
cout<<a%b<<endl;
cout<<a/b;
return 0;
}
#include <bits/stdc++.h>
using namespace std;
long long dem,x,n,i,t;
int main()
{
cin>>n;
t=0;
dem=0;
for (i=1; i<=n; i++)
{
cin>>x;
if (x%2==0)
{
dem++;
t+=x;
}
}
cout<<dem<<" "<<t;
return 0;
}
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=0 then inc(dem);
end;
writeln('so gia tri x chan la: ',dem);
readln;
end.