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 n,i,t:integer;
begin
clrscr;
readln(n);
t:=0;
for i:=1 to n do
if i mod 2=0 then t:=t+i;
write(t);
readln;
end.
Câu 1:
Program HOC24;
var i,p: integer;
t: longint;
begin
write('Nhap P: '); readln(p);
t:=0;
for i:=1 to p do if i mod 2<>0 then t:=t+i;
write('Tong cac so le la: ',t);
readln
end.
Uses crt;
var n,i,x,u: integer;
begin clrscr;
readln(n);
for i:=1 to n do begin
readln(x);
u:=u+x;
end;
writeln(u);
readln;
end.
uses crt;
var a:array[1..100]of integer;
i,n,t,kt,j:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
writeln('Cac so vua nhap la: ');
for i:=1 to n do
write(a[i]:4);
writeln;
t:=0;
for i:=1 to n do
t:=t+a[i];
writeln('Tong cua day so la: ',t);
kt:=0;
for j:=2 to trunc(sqrt(t)) do
if t mod j=0 then
begin
kt:=1;
break;
end;
if kt=0 then writeln(t,' la so nguyen to')
else writeln(t,' khong la so nguyen to');
readln;
end.
Cậu ơi sai khúc write('A[',i,']='); readln(a[i]); rồi nó cứ bị sao sao á
uses crt;
var a:array[1..100]of integer;
i,n,t,kt:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
writeln('Cac so ban vua nhap la: ');
for i:=1 to n do
write(a[i]:4);
writeln;
t:=0;
for i:=1 to n do
t:=t+a[i];
writeln('Tong cac so vua nhap la: ',t);
if t>=2 then
begin
kt:=0;
for i:=2 to trunc(sqrt(t)) do
if t mod i=0 then
begin
kt:=1;
break;
end;
if kt=0 then writeln(t,' la so nguyen to')
else writeln(t,' khong la so nguyen to');
end
else writeln(t,' khong la so nguyen to');
readln;
end.
uses crt;
var a:array[1..100]of integer;
i,n:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
for i:=1 to n do
if a[i] mod 2=0 then write(a[i]:4);
readln;
end.
uses crt;
var a:array[1..1000000] of longint;
n,i:longint;
begin
clrscr;
write('Nhap so luong phan tu: '); readln(n);
for i:=1 to n do
begin
write('Nhap phan tu thu ',i,': '); readln(a[i]);
end;
write('Cac so chan: ');
for i:=1 to n do if a[i] mod 2=0 then write(a[i],' ');
readln;
end.
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n,A[100],dem,t;
cin>>n;
for (int i=1; i<=n; i++)
cin>>A[i];
dem=0; t=0;
for (int i=1; i<=n; i++)
if (A[i]%2==0) dem++;
else t+=A[i];
cout<<dem<<endl;
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%2==0) t+=i;
cout<<t;
return 0;
}