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..50]of integer;
i,n,t,t1:integer;
begin
clrscr;
repeat
write('Nhap n='); readln(n);
until (0<n) and (n<=50);
for i:=1 to n do
begin
repeat
write('A[',i,']='); readln(a[i]);
until a[i]<=100;
end;
t:=0;
t1:=0;
for i:=1 to n do
begin
if a[i] mod 2=0 then t:=t+a[i]
else t1:=t1+a[i];
end;
writeln('Tong cac so chan la: ',t);
writeln('Tong cac so le la: ',t1);
readln;
end.
uses crt;
var a:array[1..100]of integer;
i,n,dem1,dem2,t1,t2,sa,sd,vt1,vt2:integer;
begin
clrscr;
readln(n);
for i:=1 to n do readln(a[i]);
dem1:=0;
t1:=0;
dem2:=0;
t2:=0;
for i:=1 to n do
begin
if a[i]>0 then begin inc(dem1); t1:=t1+a[i]; end;
if a[i]<0 then begin inc(dem2); t2:=t2+a[i]; end;
end;
writeln(dem1);
writeln(dem2);
writeln(t1);
writeln(t2);
for i:=1 to n do
if a[i]>0 then
begin
sd:=a[i];
vt1:=i;
break;
end;
if (dem1=0) then writeln('Khong co so duong trong day')
else writeln('So duong dau tien la: ',sd,' vi tri la: ',vt1);
for i:=1 to n do
if a[i]<0 then
begin
sa:=a[i];
vt2:=i;
break;
end;
if (dem2=0) then writeln('Khong co so am trong day')
else writeln('So am dau tien la: ',sa,' vi tri la: ',vt2);
readln;
end.
uses crt;
var a:array[1..100]of integer;
i,n,t,t1,dem:integer;
begin
clrscr;
readln(n);
for i:=1 to n do readln(a[i]);
t:=0;
for i:=1 to n do
if a[i]>0 then t:=t+a[i];
t1:=0;
for i:=1 to n do
if (a[i]>0) and (a[i] mod 2<>0) then t1:=t1+a[i];
dem:=0;
for i:=1 to n do
if a[i]>0 then dem:=dem+1;
writeln(t);
writeln(t1);
writeln(dem1);
readln;
end.
const fi='kt.txt';
fo='kq.out';
var f1,f2:text;
s:string;
i,dem,d:integer;
begin
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
readln(f1,s);
d:=length(s);
dem:=0;
for i:=1 to d do
if s[i]='e' then inc(dem);
writeln(f2,dem);
close(f1);
close(f2);
end.
uses crt;
var a:array[1..100]of integer;
i,n,t,t1,t2:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
t:=0;
for i:=1 to n do
t:=t+a[i];
t1:=0;
t2:=0;
for i:=1 to n do
begin
if a[i]>0 then t1:=t1+a[i];
if a[i]<0 then t2:=t2+a[i];
end;
writeln('Tong cac phan tu la: ',t);
writeln('Tong cac so duong la: ',t1);
writeln('Tong cac so am la: ',t2);
writeln('Trung binh cong cua day la: ',t/n:4:2);
readln;
end.
uses crt;
var a:array[1..50]of integer;
i,n,t: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
write(a[i]:4);
t:=0;
for i:=1 to n do
if (a[i] mod 2<>0) and (a[i] mod 5=0) then t:=t+a[i];
writeln;
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;
}
uses crt;
var st:string;
i,d,dem:integer;
begin
clrscr;
readln(st);
d:=length(st);
dem:=0;
for i:=1 to d do
if st[i]=' ' then dem:=dem+1;
writeln(dem+1);
readln;
end.