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.
const fi='dulieu.txt';
fo='ketqua.txt';
var f1,f2:text;
a,b:array[1..100]of integer;
n,i:integer;
begin
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
n:=0;
while not eof(f1) do
begin
n:=n+1;
readln(f1,a[n],b[n]);
end;
for i:=1 to n do
begin
if (a[i]<b[i]) then writeln(f2,a[i])
else writeln(f2,b[i]);
end;
close(f1);
close(f2);
end.
#include <bits/stdc++.h>
using namespace std;
long long a[1000],i,n,j;
bool kt;
int main()
{
freopen("nguyento.inp","r",stdin);
freopen("nguyento.out","w",stdout);
cin>>n;
for (i=1; i<=n; i++) cin>>a[i];
for (i=1; i<=n; i++)
if (a[i]>1)
{
kt=true;
for (j=2; j*j<=a[i]; j++)
if (a[i]%j==0) kt=false;
if (kt==true) cout<<a[i]<<" ";
}
return 0;
}
const fi='tong.inp';
fo='tong.out';
var f1,f2:text;
a:array[1..100]of integer;
n,i,t: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,t);
close(f1);
close(f2);
end.
uses crt;
const fi='input.txt';
fo='output.txt';
var f1,f2:text;
a,b:integer;
begin
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
readln(f1,a,b);
if (a=0) and (b=0) then writeln(f2,'Phuong trinh co vo so nghiem');
if (a<>0) then writeln(f2,-b/a:4:2);
if (a=0) and (b<>0) then writeln(f2,'Phuong trinh vo nghiem');
close(f1);
close(f2);
end.
#include <bits/stdc++.h>
using namespace std;
string st;
int d,i,dem;
int main()
{
freopen("xau.inp","r",stdin);
freopen("xau.out","w",stdout);
cin>>st;
d=st.length();
dem=0;
for (i=0; i<=d-1; i++)
if (st[i]=='a') dem++;
cout<<dem;
return 0;
}
uses crt;
const fi='data.txt';
fo='songuyen.txt';
var f1,f2:text;
a:array[1..100]of integer;
m,i,dem,k:integer;
begin
clrscr;
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
readln(f1,m);
for i:=1 to m do
read(f1,a[i]);
for i:=1 to m do
if a[i]>0 then write(f2,a[i]:4);
writeln(f2);
write('Nhap so k='); readln(k);
dem:=0;
for i:=1 to m do
if a[i] mod k=0 then inc(dem);
writeln(f2,'So cac phan tu la boi cua ',k,' la: ',dem);
close(f1);
close(f2);
readln;
end.