Những câu hỏi liên quan
Hai Yen Duong
Xem chi tiết
Nguyễn Việt Hà
Xem chi tiết
Minh Lệ
18 tháng 2 2021 lúc 19:13

Program HOC24;

const fi='DL.INP'

fo='DL.OUT'

var s: string;

d,i: byte;

f: text;

procedure ip;

begin

assign(f,fi);

reset(f);

read(f,s);

close(f);

end;

procedure out;

begin

assign(f,fo);

rewrite(f);

d:=0;

for i:=1 to length(s) do if s[i] in ['0'..'9'] then inc(d);

write(f,d);

close(f);

end;

begin

ip;

out;

end.

Bình luận (0)
Nguyễn Lê Phước Thịnh
18 tháng 2 2021 lúc 20:48

const fi='dl.inp'

fo='kq.out'

var f1,f2:text;

s:string;

d,i,dem:integer;

begin

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

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

readln(f1,s);

d:=length(s);

dem:=0;

for i:=1 to d do 

  if s[i] in ['0'..'9'] then inc(dem);

writeln(dem);

readln;

end.

Bình luận (0)
Lan Phuong
Xem chi tiết
Nguyễn Lê Phước Thịnh
20 tháng 4 2022 lúc 16:53

const fi='demxau.inp',

fo='demxau.out'

var f1,f2:text;

st:string;

d,i,dem:integer;

begin

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

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

readln(f1,st);

d:=length(st);

dem:=0;

for i:=1 to d do 

  if st[i]=' ' then dem:=dem+1;

writeln(f2,dem+1);

close(f1);

close(f2);

end.

Bình luận (0)
Quỳnh Anh Đào
Xem chi tiết
Hello Det
4 tháng 5 2022 lúc 19:27

code pascal

var f,g:text;

var s:string;

begin

assign(f,'cau2.txt'); reset(f);

read(f,s);

assign(g,'KQ.txt'); rewrite(g);

write(g,upcase(s));

close(f);

close(g);

end.

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

const fi='input.txt'

fo='output.txt'

var f1,f2:text;

st:string[125];

a:array[1..125]of string;

i,d,dem,kt,j:integer;

begin

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

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

readln(f1,st);

d:=length(st);

dem:=1;

a[1]:=st[1];

for i:=1 to d do

  begin

kt:=0;

for j:=1 to dem do 

  if a[j]=st[i] then kt:=1;

if kt=0 then 

begin

inc(dem);

a[dem]:=st[i];

end;

end;

for i:=1 to dem do 

  begin

dem1:=0;

for j:=1 to d do 

if a[i]=st[j] then inc(dem1);

writeln(f2,a[i],' xuat hien ',dem1,' lan');

end;

close(f1);

close(f2);

end.

Bình luận (0)
LA VAN CAU
Xem chi tiết
Quỳnh Như
Xem chi tiết
Nguyễn Lê Phước Thịnh
10 tháng 5 2022 lúc 23:21

uses crt;

const fi='songuyen.inp'

fo='songuyen2.out'

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

i,n,t1:integer;

f1,f2:text;

begin

clrscr;

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

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

readln(f1,n);

for i:=1 to n do readln(f1,a[i]);

t1:=0;

for i:=1 to n do if a[i] mod 2<>0 then t1:=t1+a[i];

writeln(t1);

writeln(f2,t1);

for i:=1 to n do 

  if a[i] mod 2<>0 then write(a[i]:4);

close(f1);

close(f2);

readln;

end.

Bình luận (0)
luc lun
Xem chi tiết
Nguyễn Lê Phước Thịnh
9 tháng 12 2021 lúc 23:09

#include <bits/stdc++.h>
using namespace std;
int d,i,d1;
string st;
int main()
{
    getline(cin,st);
    d=st.length();
    while (st[0]==32)
    {
       st.erase(0,1);
    }
    while (st[d-1]==32)
    {
        st.erase(d-1,1);
    }
    d1=st.length();
    for (i=0; i<d1; i++)
        if ((st[i]==32) && st[i+1]==32)
        {
            st.erase(i,1);
            i--;
        }
    cout<<st;
    return 0;
}

 

Bình luận (1)
Trần Hải Ạnh
Xem chi tiết
Nguyễn Lê Phước Thịnh
22 tháng 4 2021 lúc 21:35

const fi='xau.inp'

fo='xau.out'

var f1,f2:text;

a:array[1..100]of string;

i,d:integer;

begin

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

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

n:=0;

while not eof(f1) do 

  begin

n:=n+1;

readln(f1,a[n]);

end;

for i:=1 to n do 

  begin

for j:=1 to length(a[i]) do 

  a[i][j]:=upcase(a[i][j]);

end;

for i:=1 to n do 

  writeln(f2,length(a[i]),' ',a[i]);

close(f1);

close(f2);

end.

Bình luận (0)