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.
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.
Program HOC24;
var a: array[1..32000] of integer;
i,n: integer;
begin
write('Nhap so phan tu cua mang: '); readln(n);
for i:=1 to n do
begin
write('a[',i,']='); readln(a[i]);
end;
write('Mang vua nhap: ');
for i:=1 to n do write(a[i],' ');
writeln;
write('Cac so chan trong mang la: ');
for i:=1 to n do if a[i] mod 2=0 then write(a[i],' ');
writeln;
write('Cac so chinh phuong trong mang la: ');
for i:=1 to n do if if sqr(trunc(sqrt(a[i])))=a[i] then write(a[i],' ');
readln
end.
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;
writeln('Cac so chinh phuong la: ');
for i:=1 to n do
if sqrt(a[i])=trunc(sqrt(a[i])) then write(a[i]:4);
writeln;
writeln('Cac so chinh phuong chan la: ');
for i:=1 to n do
if ((sqrt(a[i])=trunc(sqrt(a[i]))) and (a[i] mod 2=0) then write(a[i]:4);
readln;
end.
for i:=1 to n do
if sqr(a[i])=sqr(trunc(sqrt(a[i]))) then
begin
write(a[i],' ');
if a[i] mod 2 =0 then write(a[i]);
writeln;
end;
{program bt_1;
uses crt;
Var:S ,n, i, j:longint;
Begin
clrsr;
Write('Nhap n');Readln(n);
For i:=1 to n do
Begin
S:=0;
For j:=0 to i do
if i mod j:=0 then S:=S+j;
if S=2*i then Write (i:5);
end;
readln;
end.
}
Tham khảo:
program Tinh;
uses crt;
var i,n: integer; s,t: longint; ch: char;
a : array [1..100] of longint;
begin
repeat
clrscr; readln(n); s:=0; t:=0;
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
if odd(a[i])=True then s:=s+a[i] else t:=t+a[i];
end;
writeln('Tong cac so chan : ',t);
writeln('Tong cac so le : ',s);
writeln('Tiep tuc ! (C/K) ');
ch:=readkey;
until upcase(ch)='K'
end.
uses crt;
var n,i,t:integer;
begin
clrscr;
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,t:longint;
begin
clrscr;
t:=0;
for i:=1 to 2019 do
t:=t+i;
writeln(t);
readln;
end.
uses crt;
var n,i,dem,j,t:integer;
kt:boolean;
begin
clrscr;
readln(n);
t:=0;
for i:=2 to n do
begin
kt:=true;
for j:=2 to i-1 do
if i mod j=0 then kt:=false;
if kt=true then
begin
write(i:4);
t:=t+i;
end;
end;
writeln;
writeln(t);
readln;
end.
#include <bits/stdc++.h>
using namespace std;
int i,n;
int main()
{
cin>>n;
for (i=1; i<=n; i++)
if (i%2==1) cout<<i<<" ";
return 0;
}
2:
#include <bits/stdc++.h>
using namespace std;
long long n,i;
int main()
{
cin>>n;
for (i=1; i<=n; i++)
if (n%i==0) cout<<i<<" ";
return 0;
}
uses crt;
var i:integer;
begin
clrscr;
for i:=0 to 9999 do
if trunc(sqrt(i))=sqrt(i) then write(i:4);
readln;
end.
theo C++ hay là free pascal vậy anh?