Những câu hỏi liên quan
Ngọc Ánh Phùng
Xem chi tiết
Minh Lệ
6 tháng 3 2023 lúc 23:42

Program HOC24;

var s: string;

i: byte;

begin

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

for i:=1 to length(s) do if (s[i]<>#32) and (s[i] in 'A'..'z') then 

begin

upcase(s[i]); write(s[i]);

end;

readln

end.

Bình luận (1)
Phước Thiện Lê Hoàng
Xem chi tiết
Nguyễn Lê Phước Thịnh
22 tháng 4 2021 lúc 21:27

1:

uses crt;

const fi='ketqua.txt'

var f1:text;

st:string;

i,d:integer;

begin

clrscr;

assign(f1,fi); rewrite(f1);

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

d:=length(st);

for i:=1 to d do 

 if st[i]=#32 then delete(st,i,1);

writeln(f1,st);

close(f1);

end.

Bình luận (0)
Nguyễn Lê Phước Thịnh
22 tháng 4 2021 lúc 21:29

2:

uses crt;

var a,b,c,d:integer;

{----------chuong-trinh-con-----------------------}

function min(x,y:integer):integer;

begin

if x<y then min:=x

else min:=y;

end;

{---------------chuong-trinh-chinh--------------------}

begin

clrscr;

write('a='); readln(a);

write('b='); readln(b);

write('c='); readln(c);

write('d='); readln(d);

writeln(min(a,min(b,min(c,d))));

readln;

end.

Bình luận (1)
Nguyễn Cảnh Hùng
Xem chi tiết
Đỗ Ngọc Trinh
30 tháng 4 2017 lúc 16:06

Var a: string;

  i, Dem: integer;

Begin

 writeln(‘nhap xau:’);

 Readln(a);

 Dem:=0;

 For i:=1 to length(a) do

 If a[i] =’ ‘ then

  Dem:= Dem+1;

 Writeln(Dem);

 Readln

End.

Bình luận (0)
Khánh Mỹ
Xem chi tiết
Nguyễn Lê Phước Thịnh
3 tháng 3 2021 lúc 19:45

uses crt;

var st:string;

i,d:integer;

begin

clrscr;

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

d:=length(st);

writeln('Xau vua nhap la: ',st);

for i:=1 to d do 

  if st[i]=#32 then delete(st,i,1);

writeln('Xau moi la: ',st);

readln;

end.

Bình luận (0)
ᝰᦔꫀꪑꪮꪀ
Xem chi tiết
Nguyễn Lê Phước Thịnh
1 tháng 5 2021 lúc 19:25

Câu 1: 

uses crt;

var st:string;

d,i,dem:integer;

begin

clrscr;

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

d:=length(st);

write('Xau sau khi xoa so la: ');

for i:=1 to d do 

  if not(st[i] in ['0'..'9']) then write(st[i]);

writeln;

dem:=0;

for i:=1 to d do 

  if st[i]=#32 then inc(dem);

writeln('Xau co ',dem,' dau cach');

writeln('Do dai cua xau la: ',d);

readln;

end. 

Bình luận (1)
Nguyễn Lê Phước Thịnh
1 tháng 5 2021 lúc 19:26

Câu 2: 

uses crt;

const fi='kq.out'

var st1,st2:string;

f1:text;

begin

clrscr;

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

write('Nhap xau thu 2:'); readln(st2);

assign(f1,fi); rewrite(f1);

if length(st2)>length(st1) then writeln(f1,st2)

else writeln(f1,st1);

close(f1);

end.

Bình luận (0)
Nguyễn Lê Phước Thịnh
1 tháng 5 2021 lúc 19:28

Câu 3: 

uses crt;

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

i,n,t,dem:integer;

begin

clrscr;

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

for i:=1 to n do 

  begin

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

end;

t:=0;

dem:=0;

for i:=1 to n do 

  if a[i] mod 2=0 then

begin

t:=t+a[i];

inc(dem);

end;

writeln('Trung binh cong cac so chan la: ',t/dem:4:2);

readln;

end.

Bình luận (0)
Lala
Xem chi tiết

#include <bits/stdc++.h>

using namespace std;
string a,b;
void replaceSubstring(string& a, const string& b) {
    size_t pos=0;
    while((pos=a.find(b,pos))!=string::npos) {
        a.replace(pos,b.length(),"ABC");
        pos+=3;
    }
}
int main()
{
    cin>>a>>b;
    if(a.find(b)!=string::npos){
        cout<<"YES"<<endl;
        replaceSubstring(a,b);
        cout<<a;
    }else{
        cout<<"NO"<<endl;
        cout<<a;
    }
    
    return 0;
}

Bình luận (0)
Ngưu Kim
Xem chi tiết
Phía sau một cô gái
20 tháng 3 2023 lúc 20:01

xau = input('Nhap chuoi: ')

so_khoang_cach = xau.count(' ')

print('So khoang cach:', so_khoang_cach)

vi_tri = []

for i in range(len(xau)):

     if xau[i] == ' ':

          vi_tri.append(i)

print('Vi tri khoang cach:', vi_tri)

Bình luận (0)
Đức Kiên
Xem chi tiết
Nguyễn Lê Phước Thịnh
7 tháng 5 2021 lúc 22:14

uses crt;

var st:string;

i,d,dem:integer;

begin

clrscr;

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

d:=length(st);

dem:=0;

for i:=1 to d do 

  if st[i]=#32 then inc(dem);

writeln(dem);

readln;

end.

Bình luận (0)
Thọ Phạm
Xem chi tiết
Đặng Duy Hoàng
8 tháng 1 2023 lúc 21:35

Bình luận (0)