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.
#include <bits/stdc++.h>
using namespace std;
string st,st1,st2;
int d,i;
int main()
{
getline(cin,st);
d=st.length();
st1="";
st2="";
for (i=0; i<=d-1; i++)
{
if (48<=st[i] && st[i]<=57) st1+=st[i];
else st2+=st[i];
}
cout<<st1<<st2;
return 0;
}
Var i,n:integer;
s:longint;
Begin
Write('n = ');readln(n);
For i:=1 to n-1 do
If (i mod 2 = 0) and (i mod 3 = 0) then
s:=s + i;
Write('Tong la ',s);
Readln;
End.
2:
#include <bits/stdc++.h>
using namespace std;
double a,b;
int main()
{
cin>>a>>b;
cout<<fixed<<setpricision(2)<<1/(a+b)<<endl;
return 0;
}
Bài 3:
#include <bits/stdc++.h>
using namespace std;
long long n,i,t;
int main()
{
cin>>n;
t=0;
for (i=1; i<=sqrt(n); i++)
if (i==n/i) t=t+i;
else t=t+i+n/i;
if (t==n) cout<<"Day la so hoan hao";
else cout<<"Day khong la so hoan hao";
return 0;
}
#include <bits/stdc++.h>
using namespace std;
long long s,i,n;
int main()
{
cin>>n;
s=1;
for (i=1; i<=n; i++)
if (i%2==0) s=s+i;
cout<<s;
return 0;
}
bprogram min
uses crt
var A: array [1...250] of integer
tong :integer;
begin
tong:=0
writeln(‘nhap n:’); readln (n)
forr i:=1 to n do
begin
writeln (‘nhap phan tu thu ‘,i);
readln (A[i] );
end
for i:=1 to n do
begin
if (A[i] mod 3=0)
then tong:=tong +A[i];
end
writeln (Tong cac phan tu chia het cho 3)
readln ;
end
Bài 1:
uses crt;
var a:array[1..200]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 5=0 then t:=t+a[i];
writeln('Tong cac so chia het cho 5 la: ',t);
readln;
end.
Bài 2:
uses crt;
var st:string;
d,i:integer;
begin
clrscr;
write('Nhap xau:'); readln(st);
d:=length(st);
for i:=1 to d do
if st[i]=#32 then delete(st,i,1);
writeln(st);
readln;
end.
program hotrotinhoc;
var n,i: integer;
s,st: string;
t: longint;
begin
readln(n);
for i:=1 to n do
begin
str(i,s);
st:=st+s+'+';
t:=t+i;
if t=n then break;
end;
for i:=1 to length(st)-1 do write(st[i]);
readln
end.