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.
Chương trình:
program bai_10_chuong_4;
uses crt;
var
s: string[100];
i, dem: integer;
Begin
clrscr;
write('Nhap xau vao:'); readln(s); dem:= 0;
for i:= 1 to length(s) do
if ('0'<=s[i]) and(s[i]<=’9') then dem:=dem+l;
Writeln('Trong xau s co '»dem,' chu so thap phan');
readln;
End.
uses crt;
var st:string;
i,d,dem:integer;
begin
clrscr;
write('Nhap xau:'); readln(st);
d:=length(st);
writeln('Xau vua nhap la: ',st);
dem:=0;
for i:=1 to d do
if st[i] in ['0'..'9'] then inc(dem);
writeln(dem);
readln;
end.
uses crt;
var st:string;
i,d,dem:integer;
ch:char;
begin
clrscr;
write('Nhap xau:'); readln(st);
write('Nhap ki tu:'); readln(ch);
d:=length(st);
dem:=0;
while pos(ch,st)>0 do
begin
inc(dem);
delete(st,pos(ch,st),1);
end;
writeln(dem);
readln;
end.
Program HOC24;
var s: string;
x: char;
d: byte;
begin
write('Nhap xau: '); readln(s);
write('Nhap ki tu: '); readln(x);
d:=0;
for i:=1 to length(s) do if s[i]=x then d:=d+1;
if d=0 then write('Ki tu do khong xuat hien trong xau') else write('Ki tu do xuat hien trong xau');
readln
end.
Câu 1:
#include <bits/stdc++.h>
using namespace std;
long long i,n,k,dem,x;
int main()
{
cin>>n;
cin>>k;
dem=0;
for (i=1; i<=n; i++)
{
cin>>x;
if (x==k) dem++;
}
cout<<dem;
return 0;
}
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.
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.
Chương trình:
program bai_10_chuong_4;
uses crt;
var
s: string[100];
i, dem: integer;
Begin
clrscr;
write('Nhap xau vao:'); readln(s); dem:= 0;
for i:= 1 to length(s) do
if ('0'<=s[i]) and(s[i]<=’9') then dem:=dem+l;
Writeln('Trong xau s co '»dem,' chu so thap phan');
readln;
End.
uses crt;
var s:string;
i,d,dem:integer;
begin
clrscr;
write('Nhap xau S:'); readln(s);
d:=length(s);
dem:=0;
for i:=1 to d do
if st[i]=#32 then inc(dem);
writeln(dem);
readln;
end.
#include <bits/stdc++.h>
using namespace std;
string st;
int d,i,dem;
int main()
{
getline(cin,st);
d=st.length();
dem=0;
for (i=0; i<=d-1; i++)
if ((97<=st[i] && st[i]<=122) and (st[i]!=".")) dem++;
cout<<dem;
return 0;
}
Program HOC24;
var s: string[100];
i,o,u: integer;
begin
write('Nhap xau s='); readln(s);
o:=0; u:=0;
for i:=1 to length(s) do
begin
if s[i]='o' then o:=o+1;
if s[i]='u' then u:=u+1;
end;
write('Trong day co ',o,' ki tu "o" ; va ',u,' ki tu "u"');
readln
end.