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.
uses crt;
var a,b,k,dem,x,y:longint;
begin
clrscr;
readln(a,b,k);
dem:=0;
for x:=1 to k do
for y:=1 to k do
if ((a<=b) and (a<=x*x) and (a<=y*y*y)) then dem:=dem+1;
writeln(dem);
readln;
end.
uses crt;
var n,i,o,d:integer;
function ktnt(n:integer): integer;
var i,d:integer;
begin
d:=0;
for i:=1 to sqrt(n) do
if (n mod i=0) then d:=d+1;
if d=2 then ktnt=0
else ktnt=1;
end;
begin
readln(n);
writeln(' so nguyen to be hon hoac bang n la'); {a}
for i:=1 to n do
if ktnt(i)=0 then writeln(i);
writeln('so nguyen to nho nhat khong be hon n');
o:=n;
while o>0 do
begin
if ktnt(o)=0 then
begin
write(o);
break;
end;
o:=o+1;
end;
writeln('cặp số nguyên tố là hai số nguyên lẻ liên tiếp nhỏ hơn hoặc bằng n');
o:=0;
o:=1;
d:=0;
for i:=o+2 to n do
begin
if ktnt(i)=0 then
begin
d:=d+1;
write(i,' ');
if d<2 then continue;
end;
d:=0;
writeln;
end;
readln;
end.
1. Giúp ta xem lại văn bản trước khi in, từ đó chỉnh sửa lại bố cục trình bày sao cho thích hợp, giúp tiết kiệm thời gian và công sức.
Bài 1:
uses crt;
var n,i,dem,maxd,vt,vt1,vt2,vt3,maxa,dem1:integer;
a,b,c,d,e,f,g:array[1..100]of integer;
mind,mina:int64;
begin
clrscr;
repeat
write('n='); readln(n);
if (n<=0) or (n>100) then writeln('nhap lai');
until (0<n) and (n<=100);
for i:=1 to n do
begin
write('a[',i,']='); readln(a[i]);
end;
{--------------------------so-hang-duong-----------------------}
dem:=0;
for i:=1 to n do
if a[i]>0 then
begin
inc(dem);
b[dem]:=a[i];
end;
maxd:=0;
for i:=1 to dem do
if maxd<b[i] then maxd:=b[i];
vt:=0;
for i:=1 to n do
if maxd=a[i] then
begin
vt:=vt+1;
c[vt]:=i;
end;
writeln('so hang duong lon nhat cua day la: ',maxd);
writeln('vi tri cua no lan luot la: ');
for i:=1 to vt do
write(c[i]:4);
writeln;
mind:=maxint;
for i:=1 to dem do
if mind>b[i] then mind:=b[i];
vt1:=0;
for i:=1 to n do
if mind=a[i] then
begin
inc(vt1);
d[vt1]:=i;
end;
writeln('so hang duong nho nhat cua day la: ',mind);
writeln('vi tri cua no lan luot la: ');
for i:=1 to vt1 do
write(d[i]:4);
{------------------------so-hang-am--------------------------}
writeln;
dem1:=0;
for i:=1 to n do
if a[i]<0 then
begin
inc(dem1);
e[dem1]:=a[i];
end;
maxa:=e[1];
for i:=1 to dem1 do
if maxa<e[i] then maxa:=e[i];
vt2:=0;
for i:=1 to n do
if maxa=a[i] then
begin
inc(vt2);
f[vt2]:=i;
end;
writeln('so hang am lon nhat cua day la: ',maxa);
writeln('vi tri cua no lan luot la: ');
for i:=1 to vt2 do
write(f[i]:4);
writeln;
mina:=maxint;
for i:=1 to dem1 do
if mina>e[i] then mina:=e[i];
vt3:=0;
for i:=1 to n do
if mina=a[i] then
begin
inc(vt3);
g[vt3]:=i;
end;
writeln('so hang am nho nhat cua day la: ',mina);
writeln('vi tri cua no lan luot la: ');
for i:=1 to vt3 do
write(g[i]:4);
readln;
end.
Bài 2:
uses crt;
var a,vt:array[1..10]of integer;
i,x,dem:integer;
begin
clrscr;
for i:=1 to 10 do
begin
write('a[',i,']='); readln(a[i]);
end;
write('nhap x='); readln(x);
dem:=0;
for i:=1 to 10 do
if a[i]=x then
begin
inc(dem);
vt[dem]:=i;
end;
if dem=0 then writeln('khong co gia tri ',x,' trong day')
else
begin
writeln('vi tri cua ',x,' trong day lan luot la:');
for i:=1 to dem do
write(vt[i]:4);
end;
readln;
end.
Bài 3:
uses crt;
var a:array[1..100,1..100]of integer;
n,i,j,t:integer;
begin
clrscr;
write('n='); readln(n);
for i:=1 to n do
for j:=1 to n do
begin
write('a[',i,',',j,']='); readln(a[i,j]);
end;
{----------------------------xuat-----------------------------}
writeln('ma tran ban vua nhap la:');
for i:=1 to n do
begin
for j:=1 to n do
write(a[i,j]:4);
writeln;
end;
{------------------tong-cac-phan-tu-tren-duong-cheo-chinh------------------}
t:=0;
for i:=1 to n do
for j:=1 to n do
if i=j then t:=t+a[i,j];
writeln('tong cac phan tu tren duong cheo chinh la: ',t);
readln;
end.
Bài 1:
uses crt;
var n,d,t,x,y,j,kt,i,t1,dem:integer;
st:string;
a:array[1..255]of integer;
begin
clrscr;
write('n='); readln(n);
if (0<n) and (n<1000) then
begin
{------------------------dong-1---------------------------}
str(n,st);
d:=length(st);
t:=0;
for i:=1 to d do
begin
val(st[i],x,y);
t:=t+x;
end;
writeln('tong cac chu so cua ',n,' la: ',t);
{----------------------dong-2----------------------------}
writeln('cac so nguyen to nho hon tong cac chu so cua ',n,' la: ');
dem:=0;
for i:=2 to t-1 do
begin
kt:=0;
for j:=2 to i-1 do
if i mod j=0 then kt:=1;
if kt=0 then
begin
write(i:4);
dem:=dem+1;
a[dem]:=i;
end;
end;
{----------------dong-3---------------------------}
writeln;
t1:=0;
for i:=1 to dem do
t1:=t1+a[i];
writeln('tong cac so nguyen to trong dong 2 la: ',t1);
end
else writeln('vui long nhap lai');
readln;
end.
Bài 2:
uses crt;
var a,b,i,dem,j,kt:integer;
c:array[1..100]of integer;
begin
clrscr;
write('a='); readln(a);
write('b='); readln(b);
if (20<=a) and (a<=50) and (30<=b) and (b<=75) then
begin
{------------------------dong-1--------------------------}
writeln('cac so co 2 chu so chia het cho 9 la:');
for i:=10 to 99 do
if i mod 9=0 then write(i:4);
{-----------------------dong-2--------------------------}
writeln;
writeln('cac so chinh phuong lon hon ',a,' va nho hon ',b,' la: ');
for i:=a+1 to b-1 do
if trunc(sqrt(i))=sqrt(i) then write(i:4);
{-----------------------dong-3---------------------------}
writeln;
dem:=0;
for i:=2 to b do
begin
kt:=0;
for j:=2 to i-1 do
if i mod j=0 then kt:=1;
if kt=0 then
begin
inc(dem);
c[dem]:=i;
end;
end;
writeln('so nguyen to lon nhat nho hon ',b,' la: ',c[dem]);
end
else writeln('vui long nhap lai');
readln;
end.
Bài 3:
uses crt;
var n,d,t,i,x,y:integer;
st:string;
begin
clrscr;
write('n='); readln(n);
if (0<n) and (n<105) then
begin
{---------------------------dong-1---------------------------}
str(n,st);
d:=length(st);
writeln('so luong cac chu so cua ',n,' la: ',d);
{---------------------------dong-2--------------------------}
t:=0;
for i:=1 to d do
begin
val(st[i],x,y);
t:=t+x;
end;
writeln('tong cac chu so cua ',n,' la: ',t);
{---------------------------dong-3------------------------}
writeln('phan so toi gian cua ',n,' la: 1/',n);
write('so dao nguoc cua ',n,' la: ');
for i:=d downto 1 do
write(st[i]);
end
else writeln('vui long nhap lai');
readln;
end.
Câu 1:
Program hotrotinhoc;
var i,tog,n: integer;
function tong(x: integer): integer;
var k,t: longint;
begin
t:=0;
while x<>0 do
begin
k:=x mod 10;
t:=t+k;
x:=x div 10;
end;
tong:=t;
end;
function nt(a: integer): boolean;
var j: integer;
begin
nt:=true;
if (a=2) or (a=3) then exit;
nt:=false;
if (a=1) or (a mod 2=0) or (a mod 3=0) then exit;
j:=5;
while (j<=trunc(sqrt(a))) do
begin
if (a mod j=0) or (a mod (j+2)=0) then exit;
j:=j+6;
end;
nt:=true;
end;
begin
write('Nhap so nguyen N :'); readln(n);
writeln('Tong cac chu so cua N la :',tong(n));
write('Cac so nguyen to nho hon tong cac chu so cua N la :');
for i:=1 to tong(n) do if nt(i) then
begin
write(i,' ');
tog:=tog+i;
end;
writeln;
write('Tong cac so nguyen to trong dong 2 la :',tog);
readln
end.
#include <bits/stdc++.h>
using namespace std;
long long a,b,k,x,y,dem=0;
int main()
{
cin>>a>>b>>k;
for (x=1; x<=k; x++)
{
for (y=1; y<=k; y++)
{
if (a<=x*x && a<=b && a<=y*y*y && a<=b) dem++;
}
}
cout<<dem;
return 0;
}