Viết chương trình đọc tệp a.txt chứa các số nguyên trên một dòng đưa kết quả tích các số ra màn hình
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.
![](https://rs.olm.vn/images/avt/0.png?1311)
![](https://rs.olm.vn/images/avt/0.png?1311)
n = int(input())
m=int(input())
uoc=1
for i in range min(m,n)/2:
if m%i==0 and n%i==0:
uoc = i
print(uoc)
![](https://rs.olm.vn/images/avt/0.png?1311)
Program HOC24;
var s: string;
i,d: byte;
begin
write('Nhap xau: '); readln(s);
while s[1]=#32 do delete(s,1,1);
while length(s)=#32 do delete(s,length(s),1);
while pos(#32#32,s)<>0 do delete(s,pos(#32#32,s),1);
d:=0;
for i:=1 to length(s) do if s[i]=#32 then d:=d+1;
write('Trong xau co ',d+1, ' tu');
readln
end.
![](https://rs.olm.vn/images/avt/0.png?1311)
Program HOC24;
var i,n: integer;
a: array[1..10000] of integer;
t: longint;
begin
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 if (a[i] mod 3=0) and (a[i] mod 5=0) then t:=t+a[i];
write('Tong la: ',t);
readln
end.
with open("a.txt", "r") as f:
numbers = list(map(int, f.readline().split()))
product = 1
for number in numbers:
product *= number
print("Tích các số trong file a.txt là:", product)