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 st:string;
dem,i,d:integer;
begin
clrscr;
write('st='); readln(st);
d:=length(st);dem:=0;
for i:=1 to d do
if st[i] in['0'..'9'] then inc(dem);
writeln(dem);
readln;
end.
2:
uses crt;
var n,dem,i,t:integer;
a:array[1..100]of integer;
begin
clrscr;
write('n='); readln(n);
for i:=1 to n do
begin
write('a[',i,']='); readln(a[i]);
end;
{--------------------------xu-ly----------------------------}
dem:=0;
t:=0;
for i:=1 to n do
if (a[i]>10) and (a[i]<20) then
begin
inc(dem);
t:=t+a[i];
end;
writeln('so cac so lon hon 10 va nho hon 20 la: ',dem);
writeln('tong cua chung la: ',t);
readln;
end.
1:
uses crt;
var st:string;
dem,i,d:integer;
begin
clrscr;
write('st='); readln(st);
d:=length(st);dem:=0;
for i:=1 to d do
if st[i] in['0'..'9'] then inc(dem);
writeln(dem);
readln;
end.
2:
uses crt;
var n,dem,i,t:integer;
a:array[1..100]of integer;
begin
clrscr;
write('n='); readln(n);
for i:=1 to n do
begin
write('a[',i,']='); readln(a[i]);
end;
{--------------------------xu-ly----------------------------}
dem:=0;
t:=0;
for i:=1 to n do
if (a[i]>10) and (a[i]<20) then
begin
inc(dem);
t:=t+a[i];
end;
writeln('so cac so lon hon 10 va nho hon 20 la: ',dem);
writeln('tong cua chung la: ',t);
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.
Bài 1:
Program hotrotinhoc;
var i,n: integer;
t: longint;
begin
write('Nhap n='); readln(n);
for i:=1 to n do
if (i mod 3=0) or (i mod 5=0) then t:=t+i;
write(t);
readln
end.
Bài 2: Bạn tham khảo bài 2 ở link sau Câu hỏi của dang thi khanh ly - Tin học lớp 11 | Học trực tuyến
Bài 3:
program hotrotinhoc;
var d,i,n: integer;
a: array[1..32000] of integer;
t: longint;
begin
write('Nhap n='); readln(n);
d:=0; t:=0;
for i:=1 to n do
begin
write('Nhap so thu ',i,':'); readln(a[i]);
if (a[i]>10) and (a[i]<20) then
begin
inc(d);
t:=t+a[i];
end;
end;
Writeln('Cac so lon hon 10 va nho hon 20 la ',d);
write('Tong cua chung la :',t);
readln
end.
Bài 1:
uses crt;
var n,i,t:longint;
begin
clrscr;
write('n='); readln(n);
if n>0 then
begin
t:=0;
for i:=1 to n do
if (i mod 3=0) or (i mod 5=0) then t:=t+i;
writeln('tong cac so la boi cua 3 hoac 5 la: ',t);
end
else writeln('vui long nhap so nguyen duong');
readln;
end.
Bài 2:
uses crt;
var a,b,c:real;
begin
clrscr;
write('a='); readln(a);
write('b='); readln(b);
write('c='); readln(c);
if (a>0) and (b>0) and (c>0) then
begin
if (a+b>c) and (a+c>b) and (b+c>a) then writeln('day la do dai 3 canh trong mot tam giac')
else writeln('day khong la do dai 3 canh trong mot tam giac');
end
else writeln('vui long nhap ba so duong');
readln;
end.
Bài 3:
uses crt;
var n,i,t,dem:longint;
a:array[1..100]of longint;
begin
clrscr;
write('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]>10) and (a[i]<20) then
begin
dem:=dem+1;
t:=t+a[i];
end;
writeln('cac so lon hon 10 va nho hon 20 la: ',dem);
writeln('tong cua chung la: ',t);
readln;
end.
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.
uses crt;
var n,i,dem:byte;
a:array[1..100] of longint;
tong:longint;
begin
clrscr;
write('nhap N:');readln(n);
writeln('nhap N so:');
for i:=1 to n do
begin
write('a[',i,']=');readln(a[i]);
end;
dem:=0; tong:=0;
for i:=1 to n do
begin
if (a[i]>10) and (a[i]<20) then
begin
dem:=dem+1;
tong:=tong+a[i];
end;
end;
if dem=0 then write('khong co so lon hon 10 va nho hon 20');
readln;
end.
chuc ban hoc tot
Program Bai1;
uses crt;
var x,y:integer;
begin
write('nhap vao gia tri cua x:');
readln(x);
write('nhap vao gia tri cua y:');
readln(y);
write('Tong cua hai so x va y la: ',x+y);
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.
Program Bai1;
uses crt;
var x,y:integer;
begin
write('nhap vao gia tri cua x:');
readln(x);
write('nhap vao gia tri cua y:');
readln(y);
write('Tong cua hai so x va y la: ',x+y);
readln;
end.
Var s,n,i,so:integer;
Begin
Write('Nhap so luong so n = ');readln(n);
For i:=1 to n do
Begin
Write('Nhap so thu ',i)readln(so);
If so mod 2 = 0 then s:=s+so;
End;
Write('Tong cac so chan la ',s);
Readln;
End.
Var Tong , So : Real ; I , N , Dem : Integer ;
BEGIN
Write (` Bao nhieu so : `) ; Readln ( N ) ;
Tong := 0 ; Dem := 0 ;
For I := 1 To N Do
Begin
Write (` So = `) ; Readln ( So ) ;
If ( So > 10 ) and ( So < 20 ) Then
Begin
Tong := Tong + So ;
Dem := Dem + 1 ;
End ;
End ;
Writeln (` So cac so >10 va <20 la : `, Dem ) ;
Writeln (` Tong cua chung la :`, Tong ) ;
Readln ;
END .