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;
long long a,b,t,i;
int main()
{
cin>>a>>b;
t=0;
for (i=a; i<=b; i++)
if (i%3==0) t=t+i;
cout<<t;
return 0;
}
Câu 1:
uses crt;
var m,n,ucln,i:integer;
begin
clrscr;
write('Nhap m='); readln(m);
write('Nhap n='); readln(n);
ucln:=1;
if m<n then
begin
for i:=1 to m do
if (m mod i=0) and (n mod i=0) then
begin
if ucln<i then ucln:=i;
end;
end
else begin
for i:=1 to n do
if (m mod i=0) and (n mod i=0) then
begin
if ucln<i then ucln:=i;
end;
end;
writeln(ucln);
readln;
end.
Câu 2:
uses crt;
var m,n,bcnn,i:integer;
begin
clrscr;
write('Nhap m='); readln(m);
write('Nhap n='); readln(n);
bcnn:=m*n;
for i:=m*n-1 downto 1 do
if (i mod m=0) and (i mod n=0) then
begin
if bcnn>i then bcnn:=i;
end;
writeln(bcnn);
readln;
end.
#include <bits/stdc++.h>
using namespace std;
double a,b,c,p,s;
int main()
{
cin>>a>>b>>c;
p=(a+b+c)/2;
s=sqrt(p*(p-a)*(p-b)*(p-c));
cout<<fixed<<setprecision(2)<<s;
return 0;
}
#include <bits/stdc++.h>
using namespace std;
long long i,n,a[1000],dem,t;
int main()
{
cin>>n;
for (i=1; i<=n; i++)
cin>>a[i];
t=0;
for (i=1; i<=n; i++)
if (a[i]%15==0)
{
cout<<a[i]<<" ";
t+=a[i];
}
cout<<endl;
cout<<"Tong cac so chia het cho 3 va 5 la: "<<t;
return 0;
}
Bài 1:
uses crt;
var n,t,i,d,x:integer;
st:string;
begin
clrscr;
readln(n);
str(n,st);
d:=length(st);
t:=0;
for i:=1 to d do
begin
val(st[i],x);
t:=t+x;
end;
writeln(t);
readln;
end.
#include <bits/stdc++.h>
using namespace std;
long long x,n,i,dem;
int main()
{
cin>>n;
dem=0;
for (i=1; i<=n; i++)
{
cin>>x;
if (x>0) dem++;
}
cout<<dem;
return 0;
}
program im_14424;
uses crt;
var
begin
clrscr;
write('Nhap vao y: ');
readln(y);
write('Nhap vao x: ');
readln(x);
if y>0 then
begin
for i:=1 to y do
x:=x*x;
end;
write('So can tinh la: ',x);
readln
end.
- Mình làm thì như vậy, đúng không hay chạy được không thì không biết. :Đ