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='thamso.inp';
fo='kq.inp';
var f1,f2:text;
a,b,c,delta:real;
begin
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
readln(f1,a,b,c);
delta:=sqr(b)-4*a*c;
if delta>0 then
begin
writeln(f2,'Nghiem thu nhat la: ',(-b-sqrt(delta))/2*a:4:2);
writeln(f2,'Nghiem thu hai la: ',(-b+sqrt(delta))/2*a:4:2);
end;
if delta=0 then writeln(f2,'Nghiem cua phuong trinh la: ',-b/2*a:4:2);
if delta<0 then writeln(f2,'Phuong trinh vo nghiem');
close(f1);
close(f2);
end.
const fi='tep1.txt';
fo='ketqua.txt';
var
f1,f2:text;
b,d,f:byte;
T,a,c,e:longint;
begin
assign(f1,fi);
assign(f2,fo);
reset(f1);
rewrite(f2);
Readln(f1,a,b,c,d,e,f);
close(f1);
a:=exp(b*ln(a));
c:=exp(d*ln(c));
e:=exp(f*ln(e));
t:=a+c;
t:=t+e;
writeln(f2,t);
close(t2);
end.
nếu viết chương trình giống như v nhưng cho vô hạn số thì sao ạ
Câu 2:
uses crt;
var a:array[1..100]of integer;
i,n,min,dem1,dem2,t1,t2:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
max:=a[1];
for i:=1 to n do
if max<a[i] then max:=a[i];
writeln('Gia tri lon nhat la: ',max);
dem1:=0;
dem2:=0;
t1:=0;
t2:=0;
for i:=1 to n do
begin
if a[i] mod 2=0 then
begin
inc(dem1);
t1:=t1+a[i];
end
else begin
inc(dem2);
t2:=t2+a[i];
end;
end;
writeln('So so chan la: ',dem1);
writeln('So so le la: ',dem2);
writeln('Tong cac so chan la: ',t1);
writeln('Tong cac so le la: ',t2);
readln;
end.
Câu 1:
const fi='dulieu.inp';
fo='ketqua.out';
var f1,f2:text;
m,n,t,i:integer;
begin
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
readln(f1,m,n);
t:=0;
for i:=m to n do
if i mod 2=1 then t:=t+i;
writeln(f2,t);
close(f1);
close(f2);
end.
uses crt;
const fi='kiemtra.txt';
var f1:text;
a,b,c:integer;
begin
clrscr;
assign(f1,fi); reset(f1);
readln(f1,a);
readln(f1,b);
readln(f1,c);
writeln((a+b)*(a+c)*(c+b));
close(f1);
readln;
end.
uses crt;
const fi='kiemtra.txt';
var f1:text;
a,b,c:integer;
begin
clrscr;
assign(f1,fi); reset(f1);
readln(f1,a,b,c);
writeln((a+b)*(a+c)*(b+c));
close(f1);
readln;
end.
#include <bits/stdc++.h>
using namespace std;
long long m,n,t,i;
int main()
{
freopen("dulieu.inp","r",stdin);
freopen("ketqua.out","w",stdout);
cin>>m>>n;
t=0;
for (i=m; i<=n; i++)
if (i%2!=0) t+=i;
cout<<t;
return 0;
}
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.
const fi='dulieu.inp';
fo='kq.inp';
var f1,f2:text;
a,b,c,delta:real;
begin
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
readln(f1,a,b,c);
delta:=sqr(b)-4*a*c;
if delta<0 then writeln(f2,'Phuong trinh vo nghiem');
if delta=0 then writeln(f2,'Phuong trinh co nghiem kep la: ',-b/(2*a):4:2);
if delta>0 then
begin
writeln(f2,'Nghiem thu nhat la: ',(-b+sqrt(delta))/(2*a):4:2);
writeln(f2,'Nghiem thu hai la: ',(-b-sqrt(delta))/(2*a):4:2);
end;
close(f1);
close(f2);
end.
Cảm ơn nha