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.
Program bt_3;
Uses crt;
Var Tong, n, i: integer;
Begin
Clrscr;
Writeln(‘nhap n=’);
Readln (n);
Tong:=0;
For i:=1 to n do
If I mod 5 = 0 then Tong:= Tong+i;
Writeln(‘Tong la:’,Tong);
Readln
End.
Program bt_3;
Uses crt;
Var Tong, n, i: integer;
Begin
Clrscr;
Writeln(‘nhap n=’);
Readln (n);
Tong:=0;
For i:=1 to n do
If I mod 3 = 0 then Tong:=Tong+i;
Writeln(‘Tong la:’,Tong);
Readln
End.
#include <bits/stdc++.h>
using namespace std;
long long a,b,i,dem,s;
int main()
{
cin>>a>>b;
dem=0;
s=0;
for (i=a; i<=b; i++)
if (i%2==0)
{
dem++;
s=s+i;
}
cout<<dem<<" "<<s;
return 0;
}
#include <bits/stdc++.h>
using namespace std;
long long n,i,x,a[1000],t;
int main()
{
cin>>n;
for (i=1; i<=n; i++) cin>>a[i];
cin>>x;
t=0;
for (i=1; i<=n; i++)
if (a[i]!=x)
{
cout<<a[i]<<" ";
t+=a[i];
}
cout<<endl;
cout<<t;
return 0;
}
#include <bits/stdc++.h>
using namespace std;
long long a,b,i,dem,s;
int main()
{
cin>>a>>b;
dem=0;
s=0;
for (i=a; i<=b; i++)
if (i%2==0)
{
dem++;
s=s+i;
}
cout<<dem<<" "<<s;
return 0;
}
#include <bits/stdc++.h>
using namespace std;
long long a,b,i,dem,s;
int main()
{
cin>>a>>b;
dem=0;
s=0;
for (i=a; i<=b; i++)
if (i%2==0)
{
dem++;
s=s+i;
}
cout<<dem<<" "<<s;
return 0;
}
#include <bits/stdc++.h>
using namespace std;
long long a,b,i,dem,s;
int main()
{
cin>>a>>b;
dem=0;
s=0;
for (i=a; i<=b; i++)
if (i%2==0)
{
dem++;
s=s+i;
}
cout<<dem<<" "<<s;
return 0;
}
Program HOC24;
var a,b,c,d,max: integer;
t: longint;
begin
write('Nhap a; b; c; d: '); readln(a,b,c,d);
t:=a+b+c+d;
writeln('Tong 4 so tren la: ',t);
max:=a;
if max<b then max:=b;
if max<c then max:=c;
if max<d then max:=d;
write('So lon nhat cua chung la: ',max);
readln
end.
*Cách khác:
uses crt;
var a,b,c,d,max:integer;
begin
clrscr;
write('Nhap a='); readln(a);
write('Nhap b='); readln(b);
write('Nhap c='); readln(c);
write('Nhap d='); readln(d);
writeln('Tong cua 4 so la: ',a+b+c+d);
max:=a;
if max<b then max:=b;
if max<c then max:=c;
if max<d then max:=d;
writeln('Gia tri lon nhat la: ',max);
readln;
end.
uses crt;
var a,b,x,t,i:integer;
begin
clrscr;
readln(a,b,x);
t:=0;
for i:=a to b do
if i mod x=0 then t:=t+i;
writeln(t);
readln;
end.