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.
Bài 2:
#include <bits/stdc++.h>
using namespace std;
string st;
int d;
int main()
{
getline(cin,st);
d=st.length();
cout<<d;
return 0;
}
Bài 1:
Var so,i,n,dem:integer;
Begin
Write('Nhap so luong so n = ');readln(n);
For i:=1 to n do
Begin
Write('Nhap so thu ',i);readln(so);
If so mod 2 = 0 then dem:=dem+1;
End;
Write('Co ',dem,' so chan');
Readln;
End.
Bài 2:
Var st:string;
Begin
Write('Nhap vao xau ki tu ');readln(st);
Write(' Xau vua nhap co do dai la ',length(st));
Readln;
End.
Var a: string;
i, Dem: integer;
Begin
writeln(‘nhap xau:’);
Readln(a);
Dem:=0;
For i:=1 to length(a) do
If (‘a’<=a[i]) and (a[i]<=’z’)
Dem:= Dem+1;
Writeln(Dem);
Readln
End.
Var a: string;
i, Dem: integer;
Begin
writeln(‘nhap xau:’);
Readln(a);
Dem:=0;
For i:=1 to length(a) do
If (‘A’<=a[i]) and (a[i]<=’Z’) then
Dem:= Dem+1;
Writeln(Dem);
Readln
End.
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] in ['a'..'z']) or (st[i] in ['A'..'Z']) then inc(dem);
writeln(dem);
readln;
end.
2:
uses crt;
var st:string;
d,i,dem1,dem2:integer;
begin
clrscr;
write('Nhap xau:'); readln(st);
d:=length(st);
dem1:=0;
dem2:=0;
for i:=1 to d do
begin
if st[i] in ['0'..'9'] then inc(dem1);
if (st[i] in ['a'..'z']) or (st[i] in ['A'..'Z']) then inc(dem2);
end;
writeln('So ki tu la chu so la: ',dem1);
writeln('So ki tu la chu cai la: ',dem2);
for i:=1 to d do
if st[i] in ['0'..'9'] then delete(st,i,1);
writeln('Xau sau khi xoa cac chu so la: ',st);
readln;
end.
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.