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[1000],i,n,ln,nn,t;
int main()
{
cin>>n;
for (i=1; i<=n; i++) cin>>a[i];
t=0;
for (i=1; i<=n; i++) t+=a[i];
ln=a[1];
nn=a[1];
for (i=2; i<=n; i++)
{
ln=max(ln,a[i]);
nn=min(nn,a[i]);
}
cout<<t<<endl;
cout<<ln<<" "<<nn;
return 0;
}
Var a:array[1..200] of integer;
i,n,s,max,min:integer;
Begin
Write('Nhap so luong phan tu n = ');readln(n);
For i:=1 to n do
Begin
Write('Nhap so thu ',i,' = ');readln(a[i]);
End;
s:=a[1];
max:=a[1];
min:=a[1];
For i:=2 to n do
Begin
s:=s+a[i];
If a[i] > max then max:=a[i];
If a[i] < min then min:=a[i];
End;
Writeln('Tong la ',s);
Writeln('So lon nhat la ',max);
Write('So nho nhat la ',min);
Readln;
End.
#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) or (i%5==0)) t=t+i;
cout<<t;
return 0;
}
uses crt;
var a,b:integer;
begin
clrscr;
readln(a,b);
writeln('Tong hai so la: ',a+b);
writeln('Tong binh phuong hai so la: ',sqr(a)+sqr(b));
readln;
end.
Câu 1:
uses crt;
var a,b:integer;
begin
clrscr;
readln(a,b);
write(a+b);
readln;
end.
Câu 2:
uses crt;
var a,b,c:integer;
begin
clrscr;
readln(a,b,c);
writeln(a+b-c);
readln;
end.
Câu 3:
uses crt;
var a,b:integer;
begin
clrscr;
readln(a,b);
writeln(a-b);
readln;
end.
Câu 4:
uses crt;
var x,y,z:integer;
begin
clrscr;
readln(x,y,z);
writeln((x+y)*z);
readln;
end.
uses crt;
var a,b,c,s,x:integer;
begin
clrscr;
write('hs_lop');
writeln('nhap 3 so=');readln(a,b,c);
begin
s:=a+b+c;
writeln('tong la:',s);
x:=a*b*c;
writeln('tich la:',x);
end;
if a mod 2 =0 then writeln(a,'la so chan')
else write('a,'la so le');
readln;
end.
mình ko chắc pn kt thử xem
#include <bits/stdc++.h>
using namespace std;
long long a,b,c,d;
int main()
{
cin>>a>>b>>c>>d;
cout<<a*b*c*d<<endl;
cout<<a*a+b*b+c*c<<endl;
cout<<c-d;
return 0;
}
1:
uses crt;
var i,j,t,kt:integer;
begin
clrscr;
t:=0;
for i:=1 to 100 do
if i>1 then
begin
kt:=0;
for j:=2 to i-1 do
if i mod j=0 then kt:=1;
if kt=0 then t:=t+i;
end;
writeln(t);
readln;
end.
Câu 2:
*Viết chương trình:
uses crt;
var n,p,t:integer;
begin
clrscr;
write('Nhap n='); readln(n);
t:=0;
for p:=2 to n-1 do
if n mod p=0 then t:=t+p;
writeln('Tong cac uoc that su cua ',n,' la: ',t);
readln;
end.
Program HOC24;
var i,a,b: integer;
t: longint;
begin
write('Nhap so nguyen duong a : '); readln(a);
write('Nhap so nguyen duong b : '); readln(b);
t:=0;
for i:=a to b do t:=t+i*i;
write(t);
readln
end.