Những câu hỏi liên quan
Ưu Vô
Xem chi tiết
Miner Đức
Xem chi tiết
Miner Đức
Xem chi tiết
Nguyễn Lê Phước Thịnh
14 tháng 3 2022 lúc 8:23

#include <bits/stdc++.h>

using namespace std;

long long n,i,x;

//chuongtrinhcon

bool ktnt(long long x)

{

if (x<2) return false;

for (int i=2; i*i<=x; i++)

if (x%i==0) return(false);

return true;

}

//chuongtrinhchinh

int main()

{

freopen("dl.dat","r",stdin);

freopen("kq.dat","w",stdout);

cin>>n;

dem=0;

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

{

cin>>x;

if (ktnt(x)) dem++;

}

cout<<dem;

return 0;

}

Bình luận (0)
Miner Đức
Xem chi tiết
Nguyễn Lê Phước Thịnh
21 tháng 2 2022 lúc 8:35

const fi='dl.dat'

fo='kq.dat'

var f1,f2:text;

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

i,n,dem1,dem2,t1,t2: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]);

dem1:=0;

dem2:=0;

for i:=1 to n do 

begin

if a[i] mod 2=0 then inc(dem1)

else inc(dem2);

end;

t1:=0;

t2:=0;

for i:=1 to n do 

begin

if (a[i] mod 6=0) then t1:=t1+a[i];

if (a[i] mod 9=0) and (a[i] mod 2<>0) then t2:=t2+a[i];

end;

writeln(f2,dem1,' ',dem2);

writeln(f2,t1);

writeln(f2,t2);

close(f1);

close(f2);

end.

Bình luận (0)
Ác Quỷ Bé Mon
21 tháng 2 2022 lúc 8:52

const fi='dl.dat'

fo='kq.dat'

var f1,f2:text;

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

i,n,dem1,dem2,t1,t2: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]);

dem1:=0;

dem2:=0;

for i:=1 to n do 

begin

if a[i] mod 2=0 then inc(dem1)

else inc(dem2);

end;

t1:=0;

t2:=0;

for i:=1 to n do 

begin

if (a[i] mod 6=0) then t1:=t1+a[i];

if (a[i] mod 9=0) and (a[i] mod 2<>0) then t2:=t2+a[i]

end

writeln(f2,dem1,' ',dem2)

writeln(f2,t1)

writeln(f2,t2)

close(f1)

close(f2)

;-;

Bình luận (0)
Nguyễn Cảnh Hùng
Xem chi tiết
Đỗ Ngọc Trinh
29 tháng 12 2017 lúc 16:07

Assign(f,’DL.TXT’);

Reset(f);

Read(f,x1,x2);

Close(f);

Bình luận (0)
Kieu Anh
Xem chi tiết
Nguyễn Hoàng Liêu
12 tháng 10 2018 lúc 20:25

C

Bình luận (0)
Thu Phương
Xem chi tiết
Minh Lệ
12 tháng 5 2023 lúc 23:49

Thứ tự sắp xếp

12. End.

8. End;

11. Readln;

2. Begin

7. Readln(f,i);

9. Close(f);

1. Var f:text; i: byte;

10. writeln(i);

3. Assign(f,'D:/so.txt');

4. Reset(f);

5. While not(eof(f)) Do

6. Begin

Bình luận (0)
Nguyễn Minh Lệ
Xem chi tiết
Nguyễn Trung Hiếu
19 tháng 6 2019 lúc 8:46

Ok thanks bạn!!!

Bình luận (0)
nguyễn văn thành đạt
Xem chi tiết