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 hoa,tien:longint;
begin
clrscr;
write('nhap vao so hoa da ban:');readln(hoa);
if hoa<100 then tien:=5000*hoa
else tien:=300*hoa;
write('so tien ban hoa la:',tien,' dong');
readln;
end.
chúc bạn học tốt
1:
uses crt;
var a,b,i,tsc,tsl:integer;
begin
clrscr;
write('nhap a='); readln(a);
write('nhap b='); readln(b);
if (a>0) and (b>0) then
begin
if a<b then
begin
tsc:=0;
tsl:=0;
for i:=a to b do
if i mod 2=0 then tsc:=tsc+i
else tsl:=tsl+i;
writeln('tong cac so chan trong khoang tu ',a,' toi ',b,' la: ',tsc);
writeln('tong cac so le trong khoang tu ',a,' toi ',b,' la: ',tsl);
end
else writeln('vui long nhap a be hon b');
end
else writeln('vui long nhap hai so duong');
readln;
end.
2:
uses crt;
var n,i:integer;
begin
clrscr;
write('n='); readln(n);
if (n>=5) then
begin
writeln('cac so nguyen le trong khoang tu 5 toi ',n,' la: ');
for i:=5 to n do
if i mod 2=1 then write(i:4);
end
else writeln('vui long nhap n lon hon hoac bang 5');
readln;
end.
3:
uses crt;
var m,n,i:integer;
s:longint;
begin
clrscr;
write('m='); readln(m);
write('n='); readln(n);
if (m>0) and (n>0) then
begin
if m<n then
begin
s:=1;
for i:=m to n do
if i mod 2=0 then s:=s*i;
writeln('tich cac so chan trong pham vi tu ',m,' toi ',n,' la: ',s);
end
else writeln('vui long nhap m nho hon n');
end
else writeln('vui long nhap hai so duong');
readln;
end.
4:
uses crt;
var x,y,i,j:integer;
begin
clrscr;
write('x='); readln(x);
write('y='); readln(y);
if (x>0) and (y>0) then
begin
if x<y then
begin
writeln('day cac so nguyen duong trong pham vi tu ',x,' toi ',y,' la:');
for i:=x to y do
write(i:4);
writeln;
writeln('day cac so nguyen duong trong pham vi tu ',y,' toi ',x,' la:');
for j:=y downto x do
write(j:4);
end
else writeln('vui long nhap x nho hon y');
end
else writeln('vui long nhap hai so duong');
readln;
end.
program so_luong_chu_A;
uses crt;
var
st:string;
i,dem:integer;
begin
clrscr;
writeln('Moi nhap xau :',st); readln(st);
dem:=0;
for i:=1 to length(st) do
begin
if (st[i]='A') then inc(dem);
end;
writeln(dem);
for i:=1 to dem do write('A');
readln;
end.
uses crt;
var a,b,c:array[1..1000]of integer;
i,n,dem,max:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
dem:=0;
max:=a[1];
for i:=1 to n do
if max<a[i] then max:=a[i];
for i:=1 to n do
if max=a[i] then
begin
inc(dem);
b[dem]:=a[i];
c[dem]:=i;
end;
if dem=1 then writeln('So lon nhat la: ',b[dem],' vi tri la: ',c[dem])
else writeln('So lon nhat la: ',b[1],' vi tri la: ',c[1]);
readln;
end.
Câu 1:
uses crt;
var a:array[1..100]of integer;
n,i,tl,tc:integer;
begin
clrscr;
repeat
write('nhap n='); readln(n);
if (n<=0) or (n>100) then writeln('ban da nhap sai, yeu cau ban nhap lai');
until (0<n) and (n<=100);
for i:=1 to n do
begin
repeat
write('a[',i,']='); readln(a[i]);
if abs(a[i])>=1000 then writeln('vui long nhap so co gia tri tuyet doi nho hon 1000');
until abs(a[i])<1000;
end;
{--------------------------xu-ly-----------------------------}
tc:=0;
tl:=0;
for i:=1 to n do
begin
if a[i] mod 2=0 then tc:=tc+a[i];
if a[i] mod 2=1 then tl:=tl+a[i];
end;
writeln('tong so nguyen chan cua day la: ',tc);
writeln('tong so nguyen le cua day la: ',tl);
readln;
end.
Câu 2:
uses crt;
var a:array[1..100]of integer;
n,i:integer;
begin
clrscr;
repeat
write('nhap n='); readln(n);
if (n<=0) or (n>100) then writeln('ban da nhap sai, yeu cau ban nhap lai');
until (0<n) and (n<=100);
for i:=1 to n do
begin
write('a[',i,']='); readln(a[i]);
end;
{--------------------------xu-ly-----------------------------}
writeln('cac so nguyen am co trong day la: ');
for i:=1 to n do
if a[i]<0 then write(a[i]:4);
readln;
end.
Câu 3:
uses crt;
var a:array[1..100]of integer;
n,i,t:integer;
begin
clrscr;
repeat
write('nhap n='); readln(n);
if (n<=0) or (n>100) then writeln('ban da nhap sai, yeu cau ban nhap lai');
until (0<n) and (n<=100);
for i:=1 to n do
begin
write('a[',i,']='); readln(a[i]);
end;
{--------------------------xu-ly-----------------------------}
t:=0;
for i:=1 to n do
if a[i] mod 3=0 then t:=t+a[i];
writeln('tong cac phan tu chia het cho 3 la: ',t);
readln;
end.
Câu 4:
uses crt;
var a,vt:array[1..100]of integer;
n,i,t,dem,j:integer;
min:int64;
begin
clrscr;
repeat
write('nhap n='); readln(n);
if (n<=0) or (n>100) then writeln('ban da nhap sai, yeu cau ban nhap lai');
until (0<n) and (n<=100);
for i:=1 to n do
begin
repeat
write('a[',i,']='); readln(a[i]);
if abs(a[i])>=1000 then writeln('vui long nhap so co gia tri tuyet doi nho hon 1000');
until abs(a[i])<1000;
end;
{--------------------------xu-ly-----------------------------}
min:=maxint;
for i:=1 to n do
if min>a[i] then min:=a[i];
dem:=0;
for i:=1 to n do
if a[i]=min then
begin
inc(dem);
vt[dem]:=i;
end;
writeln('so nho nhat la: ',min);
writeln('vi tri cua no trong day lan luot la: ');
for j:=1 to dem do
write(vt[j]:4);
readln;
end.
Câu 5:
uses crt;
var a,vt:array[1..100]of integer;
n,i,j,tam:integer;
begin
clrscr;
repeat
write('nhap n='); readln(n);
if (n<=0) or (n>100) then writeln('ban da nhap sai, yeu cau ban nhap lai');
until (0<n) and (n<=100);
for i:=1 to n do
begin
repeat
write('a[',i,']='); readln(a[i]);
if abs(a[i])>=1000 then writeln('vui long nhap so co gia tri tuyet doi nho hon 1000');
until abs(a[i])<1000;
end;
{--------------------------xu-ly-----------------------------}
for i:=1 to n-1 do
for j:=i+1 to n do
if a[i]<a[j] then
begin
tam:=a[i];
a[i]:=a[j];
a[j]:=tam;
end;
writeln('day so giam dan la: ');
for i:=1 to n do
write(a[i]:4);
readln;
end.
uses crt;
var a:array[1..20]of integer;
i,j,tam,t,max,min:integer;
begin
clrscr;
for i:=1 to 20 do
begin
write('A[',i,']='); readln(a[i]);
end;
write('Cac so le la: ');
for i:=1 to 20 do
if a[i] mod 2<>0 then write(a[i]:6);
writeln;
write('Cac so chan la: ');
for i:=1 to 20 do
if a[i] mod 2=0 then write(a[i]:6);
writeln;
t:=0;
for i:=1 to 20 do
t:=t+a[i];
writeln('Tong cua day so la: ',t);
max:=a[1];
min:=a[1];
for i:=1 to 20 do
begin
if max<a[i] then max:=a[i];
if min>a[i] then min:=a[i];
end;
write('Vi tri cua so nho nhat la: ');
for i:=1 to 20 do
if min=a[i] then write(i:4);
writeln;
write('Vi tri cua so lon nhat la: ');
for i:=1 to 20 do
if max=a[i] then write(i:4);
readln;
end.
#include <iostream>
using namespace std;
int main() {
int N,M,X;
cin >> N >> M >> X;
cout << N-M*X;
return 0;
}
if G>100000 then wirte('giam gia 10%') else wirteln('giam gia 5%');
var n:int64;
begin
readln(n);
if n>100000 then n:=n div 10 else n:=n div 20;
write(n);
end.
Bài 1:
uses crt;
var a:array[1..1000]of integer;
n,i,t,dem:integer;
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]>0) and (a[i] mod 2<>0) then
begin
inc(dem);
t:=t+a[i];
end;
writeln(t/dem:4:2);
readln;
end.
Bài 2:
uses crt;
var s:string;
i,d:integer;
kt:boolean;
begin
clrscr;
write('Nhap xau:'); readln(s);
d:=length(s);
for i:=1 to d do
if s[i]=' ' then delete(s,i,1);
s:=upcase(s);
writeln(s);
readln;
end.
uses crt;
var n,m,a:integer;
Begin
clrscr;
write('Nhap n:'); readln(n);
write('Nhap m:'); readln(m);
write('Nhap a:'); readln(a);
write('T=');
if n<a then writeln(n*m) else writeln(n*m*75/100:0:0);
readln;
End.