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.
uses crt;
var a:array[1..100]of integer;
i,n,t,ln,nn:integer;
begin
clrscr;
readln(n);
for i:=1 to n do readln(a[i]);
t:=0;
for i:=1 to n do
t:=t+a[i];
writeln(t);
ln:=a[1];
nn:=a[1];
for i:=1 to n do
begin
if ln<a[i] then ln:=a[i];
if nn>a[i] then nn:=a[i];
end;
writeln(ln);
writeln(nn);
readln;
end.
Uses Crt;
Var A : array [1..1000] of longint;
n, m, d, t, i, S, k : longint;
Begin
//Phan A
Clrscr;
Writeln(' Phan A ');
Write(' Ban hay nhap 1 so n bat ky: ');
Readln(n);
Write(' Cac so chia het cho ba tu 1 den ',n,' la: ');
For i:=1 to n do
If (i mod 3) = 0 then Write(' ',i);
//Phan B
Writeln;
Writeln(' Phan B ');
Write(' Ban hay nhap 1 so m bat ky: ');
Readln(m);
For i:=1 to m do
Begin
Write(' Ban hay nhap hang tu thu ',i,': ');
Readln(A[i]);
S:= S+A[i];
End;
Write(' Tong cua day so tren la: ',S);
//Phan C
Writeln;
Writeln(' Phan C ');
Write(' Ban hay nhap 1 so d bat ky: ');
Readln(d);
Write(' Ban hay nhap so K: ');
Readln(k);
For i:=1 to n do
Begin
Write(' Ban hay nhap hang tu thu ',i,': ');
Readln(A[i]);
If ((A[i] div k)=1)then t:=t+1;
End;
Write(' Co tat ca ',t,' so giong ',k);
Readln;
End.
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n,t=0;
cin>>n;
for (int i=1; i<=n; i++)
if (i%6==0) t+=i;
cout<<t;
return 0;
}
#include <bits/stdc++.h>
using namespace std;
long long n,i,t;
int main()
{
cin>>n;
t=0;
for (i=1; i<=n; i++)
if (i%3==0) t+=i;
cout<<t;
return 0;
}
Var a:array[1..1000] of integer;
i,x:integer;
s:longint;
Begin
Write('x = ');readln(x);
For i:=1 to x do
Begin
Write('Nhap phan tu thu ',i);readln(a[i]);
if a[i] mod 2 = 0 then s:=s+a[i];
End;
writeln('Tong cac so chia het cho 2 la ',s);
write('Cac so vua nhap la ');
for i:=1 to x do write(a[i]:5);
Readln
End.
uses crt;
var a:array[1..100]of integer;
i,n,t,ln,nn:integer;
begin
clrscr;
readln(n);
for i:=1 to n do readln(a[i]);
ln:=a[1];
nn:=a[1];
t:=0;
for i:=1 to n do
begin
if ln<a[i] then ln:=a[i];
if nn>a[i] then nn:=a[i];
t:=t+a[i];
end;
writeln(ln);
writeln(nn);
writeln(t);
for i:=1 to n do
if a[i] mod 2=0 then write(a[i]:4);
readln;
end.
var n,i,max,min,s: integer;
a: array[1..100] of integer;
begin
readln(n);
for i:=1 to n do begin
readln(a[i]);
s:=s+a[i];
end;
max:=a[1]; min:=a[1];
for i:=2 to n do begin
if max<a[i] then max:=a[i];
if min>a[i] then min:=a[i];
end;
writeln('MAX=',max,' | MIN=',min);
for i:=1 to n do if a[i] mod 2=0 then write(a[i],' '); writeln;
write('Tong = ',s);
readln
end.
uses crt;
var a:array[1..100]of integer;
i,n,t1,t2,t3:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
t1:=0;
for i:=1 to n do
if a[i]<0 then t1:=t1+a[i];
writeln('Tong cac so am la: ',t1);
t2:=0;
for i:=1 to n do
if a[i] mod 2=0 then t2:=t2+a[i];
writeln('Tong cac so chia het cho 2 la: ',t2);
t3:=0;
for i:=1 to n do
if (a[i]>0) and (a[i] mod 3=0) then t3:=t3+a[i];
writeln('Tong cac so duong chia het cho 3 la: ',t3);
readln;
end.