Bạn chưa đăng nhập. Vui lòng đăng nhập để hỏi bài

Những câu hỏi liên quan
Ngânn Okk
Xem chi tiết
Bùi Anh Tuấn
12 tháng 3 2021 lúc 19:45

Thinh phạm
12 tháng 3 2021 lúc 14:41

Program hotrotinhoc;

var s: string;

t,c,i: byte;

begin

write('Nhap s:'); readln(s);

t:=0;

for i:=1 to length(s) do

if s[i] in ['1'..'9'] then

begin

val(s[i],c);

t:=t+c;

end;

write(t);

readln

end.

Thu gọn

Nguyễn Thảo Vy
Xem chi tiết
Phan thị lê na
Xem chi tiết
Nguyễn Lê Phước Thịnh
6 tháng 4 2021 lúc 12:40

1:

uses crt;

var a:array[1..100]of integer;

i,n,t:integer;

begin

clrscr;

write('Nhap n='); readln(n);

for i:=1 to n do 

  begin

write('A[',i,']='); readln(a[i]);

end;

t:=0;

for i:=1 to n do 

  if a[i] mod 2<>0 then t:=t+a[i];

writeln(t);

readln;

end.

Nguyễn Lê Phước Thịnh
6 tháng 4 2021 lúc 12:42

3:

const fi='dl.txt'

fo='kq.txt'

var f1,f2:text;

a:integer;

begin

assign(f1,fi); reset(f1);

assign(f2,fo); rewrite(f2);

readln(f1,a);

writeln(f2,a);

close(f1);

close(f2);

end.

Nguyễn Lê Phước Thịnh
6 tháng 4 2021 lúc 12:41

2:

uses crt;

var st:string;

d:integer;

begin

clrscr;

write('Nhap xau:'); readln(st);

d:=length(st);

while st[1]=#32 do 

  begin

delete(st,1,1);

d:=length(st);

end;

while st[d]=#32 do 

  begin

delete(st,d,1);

d:=length(st);

end;

writeln(st);

readln;

end.

Linh Da
Xem chi tiết
Nguyen Hung
26 tháng 4 2021 lúc 20:16

Uses crt;

Var i:integer;

      s1,s2:string;

Begin

clrscr;

Writeln('Nhap xau:');readln(s1);

s2:=''

i:=length(s1);

While s1[i]<> ' ' do 

  Begin

  s2:=s2+s1[i];

  i:=i-1;

  End;

Writeln('Tu sau cung cua xau la:');

For i:=length(s2) downto 1 do write(s2[i]);

readln;

End.

Nguyễn Lê Phước Thịnh
26 tháng 4 2021 lúc 20:17

uses crt;

var st,s:string;

i,d:integer;

begin

clrscr;

readln(st);

d:=length(st);

s:=''

i:=d;

while st[i]<>#32 do

  begin

     s:=s+st[i];

     i:=i-1;

  end;

for i:=length(s) downto 1 do

  write(s[i]);

readln;

end.

Linh Đan
Xem chi tiết
Võ Đức Dũng
17 tháng 9 2021 lúc 21:33

câu 1

Program Nguyen_to;

Var n,i:integer;

Function NT(n:integer):Boolean;

Var ok: Boolean;

i: integer;

Begin ok:=true;

for i:=2 to n-1 do if (n mod i)= 0 then ok:=ok and false;

if n < 2 then NT:=false else NT:=ok;

End;

Begin Write('Nhap n: ');

Readln(n); i:=n;

Repeat i:=i+1;

Until NT(i);

Write('So nguyen to nho nhat lon hon ',n, 'la: ',i);

Readln End.

Võ Đức Dũng
17 tháng 9 2021 lúc 21:39

câu 2

uses crt;

const so: set of char=['0','1','2','3','4','5','6','7','8','9'];

var a:array[1..100] of integer;

st,b:string;

c,l,i,n,j:integer;

s, Max: integer;

begin clrscr;

write('Nhap xau:');

readln(st);

l:=length(st);

i:=1;

n:=0;

repeat if (st[i] in so) then begin b:=''

repeat b:=b+st[i];

inc(i);

until (not(st[i] in so)) or (i>l);

inc(n);

val(b,a[n],c);

end;

inc(i);

until i>l;

Max:=a[1];

for i:=2 to n do If Max<A[i] Then Max:=A[i];

Writeln('Phan tu lon nhat cua mang:', Max);

readln;

end.

Duy Nguyễn
Xem chi tiết
Dương Nguyễn
Xem chi tiết
Nguyễn Khánh Linh
28 tháng 3 2022 lúc 23:25

Chịu thôi, sorry :))

Asuna
Xem chi tiết
Dương Nguyễn
Xem chi tiết