Bạn chưa đăng nhập. Vui lòng đăng nhập để hỏi bài

Những câu hỏi liên quan
Ly Khánh
Xem chi tiết
Van Doan Dao
Xem chi tiết
Luân Đào
30 tháng 12 2020 lúc 5:55

uses crt;

var a:array[1..1000] of integer;

n,i: integer;

sa,d: integer;

begin

write('Nhap N: '); readln(n);

for i:=1 to n do

begin

write('a[',i,'] = '); readln(a[i]);

end;

sa:=0;

d:=0;

for i:=1 to n do

if a[i] > 0 then d:=d+1 else if a[i] < 0 then sa:=sa+1;

writeln('Trong day co ',d,' so duong');

writeln('Trong day co ',sa,' so am');

readln

end.

ngo minh duc
Xem chi tiết
Nguyễn Lê Phước Thịnh
21 tháng 3 2021 lúc 9:26

Câu 7:

const fi='dayso.inp'

fo='dayso.out'

var f1,f2:text;

a,b:array[1..100]of integer;

i,n,dem,j,t,kt,dem1:integer;

begin

assign(f1,fi); reset(f1);

assign(f2,fo); rewrite(f2);

readln(f1,n);

for i:=1 to n do 

  read(f1,a[i]);

t:=0;

for i:=1 to n do 

  t:=t+a[i];

writeln(f2,'Tong cua day so la: ',t);

b[1]:=a[1];

dem:=1;

for i:=1 to n do 

  begin

kt:=0;

for j:=1 to dem do 

  if a[i]=b[j] then kt:=1;

if kt=0 then

begin

inc(dem);

b[dem]:=a[i];

end;

end;

for i:=1 to dem do 

  begin

dem1:=0;

for j:=1 to n do 

  if b[i]=a[j] then inc(dem1);

writeln(f2,b[i],' xuat hien ',dem1,' lan');

close(f1);

close(f2);

end.

Nguyễn Giang
Xem chi tiết
Nguyễn Lê Phước Thịnh
1 tháng 5 2021 lúc 19:39

uses crt;

const fi='mang.txt'

var a:array[1..100]of integer;

i,n,t1,t2:integer;

f1:text;
begin

clrscr;

assign(f1,fi); rewrite(f1);

write('Nhap n='); readln(n);

for i:=1 to n do 

  begin

write('A[',i,']='); readln(a[i]);

end;

t1:=0;

t2:=0;

for i:=1 to n do 

  begin

if a[i]>0 then 

begin

t1:=t1+a[i];

end;

if a[i]<0 then

begin

t2:=t2+a[i];

end;

end;

writeln(f1,'Tong cac so duong la: ',t1);

writeln(f1,'Tong cac so am la: ',t2);

if abs(t1)>abs(t2) then writeln(f1,'Gia tri tuyet doi cua ',t1,' lon hon gia tri tuyet doi cua ',t2)

else if abs(t1)<abs(t2) then writeln(f1,'Gia tri tuyet doi cua ',t2,' lon hon gia tri tuyet doi cua ',t1)

else writeln(f1,'Gia tri tuyet doi cua ',t1,' bang gia tri tuyet doi cua ',t2);

close(f1);

end.

chí đăng
Xem chi tiết
APOK FF
Xem chi tiết
Đỗ Ngọc Quỳnh
Xem chi tiết
Phạm Phương Mai
20 tháng 1 2016 lúc 18:01

1 S

2 Đ

3 Đ

4 Đ

5 S

6 S

Thuận Quốc
20 tháng 1 2016 lúc 18:01
SaiĐúngĐúng....... Viết đê thiếuSaiSai
Bùi Văn Minh
20 tháng 1 2016 lúc 18:01

câu 5 đúng các câu còn lại sai bạn nhé

Lự Đam
Xem chi tiết
Nguyễn Lê Phước Thịnh
5 tháng 5 2021 lúc 13:20

uses crt;

var a:array[1..100]of integer;

i,n,dem1,dem2:integer;

begin

clrscr;

write('Nhap n='); readln(n);

for i:=1 to n do

 begin

write('A[',i,']='); readln(a[i]);

end;

dem1:=0;

dem2:=0;

for i:=1 to n do 

 begin

if a[i]>0 then inc(dem1);

if a[i]<0 then inc(dem2);

end;

writeln('So so nguyen duong la: ',dem1);

writeln('So so nguyen am la: ',dem2);

readln;

end.

DƯƠNG VĂN TÀI
Xem chi tiết
Nguyễn Lê Phước Thịnh
27 tháng 10 2021 lúc 15:16

#include <bits/stdc++.h>

using namespace std;

long long n,i,x,t;

int main()

{

cin>>n;

t=0;

for (i=1; i<=n; i++)

{

cin>>x;

if ((x<0) and (x%2!=0)) t=t+x;

}

cout<<t;

return 0;

}