Những câu hỏi liên quan
NGUYỄN VIẾT LUẬN
Xem chi tiết
Ngô Chí Thành
Xem chi tiết
Nguyễn Lê Phước Thịnh
9 tháng 4 2021 lúc 9:40

Uses crt;

Var st:string;

I,d:integer;

Begin

Clrscr;

Write('nhap xau:'); readln(st);

D:=length(st);

While st[d]=#32 do

Begin

Delete(st,d,1);

D:=length(st);

End;

For i:=1 to d do

If (st[i]=#32) and (st[i+1]=#32) then delete(st,i,1);

Writeln(st);

Readln;

End.

Bình luận (0)
Ngô Chí Thành
Xem chi tiết
Nguyễn Lê Phước Thịnh
9 tháng 4 2021 lúc 9:29

Uses crt;

Var st:string;

I,d:integer;

Begin

Clrscr;

Write('nhap xau:'); readln(st);

D:=length(st);

While st[d]=#32 do

  Begin

Delete(st,d,1);

D:=length(st);

End;

For i:=1 to d do

  If (st[i]=#32) and (st[i+1]=#32) then delete(st,i,1);

Writeln(st);

Readln;

End.

Bình luận (0)
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.

Bình luận (0)
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.

Bình luận (0)
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.

Bình luận (0)
Long ca ca
Xem chi tiết
Nguyễn Hoàng Duy
1 tháng 7 2023 lúc 19:52

program  Nenxau;

var s: string;
        i, count: integer;
        c: char;

begin
  readln(s);
  count := 1;
  c := s[1];
  for i := 2 to length(s) do
    begin
      if s[i] = c then
        inc(count)
      else
        begin
          write(count);
          write(c);
          count := 1;
          c := s[i];
        end;
    end;
  write(count);
  write(c);
end.

Bình luận (0)
H TC
Xem chi tiết
anime khắc nguyệt
3 tháng 3 2022 lúc 8:09

tk 
 

uses crt;

var st1:string;   

i,d:integer;

begin

clrscr;

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

d:=length(st1);

for i:=1 to d do

  if (st1[i]='a') and (st1[i+1]='b') and (st1[i+2]='c') then delete(st1,i,3);

writeln(st1);

readln;

end.

Bình luận (0)
nguyễn an phát
Xem chi tiết
Nguyễn Lê Phước Thịnh
1 tháng 3 2021 lúc 17:27

uses crt;

var st1:string;   

i,d:integer;

begin

clrscr;

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

d:=length(st1);

for i:=1 to d do

  if (st1[i]='a') and (st1[i+1]='b') and (st1[i+2]='c') then delete(st1,i,3);

writeln(st1);

readln;

end.

Bình luận (1)
Asuna
Xem chi tiết
NgocTuan
Xem chi tiết
Nguyễn Lê Phước Thịnh
23 tháng 1 2022 lúc 20:08

#include <bits/stdc++.h>

using namespace std;

string st;

int d,i;

int main()

{

getline(cin,st);

d=st.length();

for (i=0; i<=d-1; i++)

if ((st[i]==' ') and (st[i+1]=' ')) st.erase(i,1);

cout<<st;

return 0;

}

Bình luận (0)