K
Khách

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.

14 tháng 3 2018

program bai_tap;
var i,x,y:integer;
begin
assign(output,'D:\A.txt');
rewrite(output);
for i:= 1 to 3 do
begin
read(x,y);
writeln(x,' ',y);
end;
close(output);
end.

uses crt;

const fi='tamgiac.dat';

var f1:text;

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

n,i,j,k,dem:integer;

begin

clrscr;

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

n:=0;

while not eof(f1) do 

  begin

inc(n);

readln(f1,a[n],b[n],c[n]);

end;

dem:=0;

for i:=1 to n do 

for j:=1 to n do 

for k:=1 to n do

if (i=j) and (j=k) then

begin

  if (a[i]+b[j]>c[k]) and (a[i]+c[k]>b[j]) and (c[k]+b[j]>a[i]) then

  begin

if (a[i]=b[j]) and (a[i]<>c[k]) and (b[j]<>c[k]) then inc(dem);

if (a[i]=c[k]) and (a[i]<>b[j]) and (c[k]<>b[j]) then inc(dem);

if (b[j]=c[k]) and (b[j]<>a[i]) and (c[k]<>a[i]) then inc(dem);

end;

end;

writeln(dem);

readln;

end.

uses crt;

const fi='kq.txt';

var a:array[1..15]of real;

i,n:integer;

f1:text;

begin

clrscr;

n:=15;

for i:=1 to n do readln(a[i]);

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

for i:=1 to n do 

  begin

 if (i mod 5=0) then writeln(f1)

else write(f1,a[i],' ');

end;

close(f1);

readln;

end.

uses crt;

const fo='b.txt';

var f1:text;

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

i,n:integer;

begin

clrscr;

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

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

for i:=1 to n do

begin

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

end;

for i:=1 to n do

write(f1,a[i]:4);

close(f1);

readln;

end.

29 tháng 1 2021

program cap_so_cong; 

uses crt; var a: array[1..100] of integer; i, n, k: integer;

{i la bien dem, k de luu cap so} begin clrscr; write('N= ');

readln(n); for i:=1 to n do begin write('A(',i,')= ');

readln(a[i]);

 end; 

{Bat dau phan kiem tra} k:=a[2]-a[1]; i:=2; repeat i:= i+1; until (a[i]<>a[i-1]+k) or (i>n);

 if i>n then write('Day A la mot cap so cong') else

write('Day A khong phai la mot cap so cong');

 readln 

end. 

24 tháng 4 2023

Uses crt;

var i,n,k,u,f,y: longint;

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

begin clrscr;

readln(n);

for i:=1 to n do read(a[i]); readln;

writeln(a[i]);

for i:=1 to n do if(a[i]<0) then k:=k+a[i];

for i:=1 to n do if(a[i]>0) then u:=u+a[i];

for i:=1 to n do if(a[i] mod 2<>0) then f:=f+a[i];

for i:=1 to n do if(a[i] mod 2=0) then y:=y+a[i];

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

writeln('Tong cac so khong am: ',u);

writeln('Tong cac so le la: ',f);

writeln('Tong cac so chan la: ',y);

readln;

end.

18 tháng 10 2021

#include <bits/stdc++.h>

using namespace std;

double xa,ya,xb,yb,xc,yc,ab,ac,bc;

int main()

{

cin>>xa>>ya>>xb>>yb>>xc>>yc;

ab=(sqrt((xa-xb)*(xa-xb)+(ya-yb)*(ya-yb)));

ac=(sqrt((xa-xc)*(xa-xc)+(ya-yc)*(ya-yc)));

bc=(sqrt((xb-xc)*(xb-xc)+(yb-yc)*(yb-yc)));

p=(ab+bc+ac)/2;

s=sqrt(p*(p-ab)*(p-ac)*(p-bc));

cout<<"Dien tich la:"<<fixed<<setprecision(2)<<s<<endl;

cout<<"Duong cao ung voi dinh A la:"<<fixed<<setprecision(2)<<2*s/bc<<endl;

cout<<"Duong cao ung voi dinh B la:"<<fixed<<setprecision(2)<<2*s/ac<<endl;

cout<<"Duong cao ung voi dinh C la:"<<fixed<<setprecision(2)<<2*s/ab<<endl;

return 0;

}

#include <bits/stdc++.h>

using namespace std;

long long a[1000],n,i,nn,t;

int main()

{

cin>>n;

for (i=1; i<=n; i++) cin>>a[i];

nn=a[1];

for (i=1; i<=n; i++) nn=min(nn,a[i]);

t=0;

for (i=1; i<=n; i++) if (a[i]%2!=0) t+=a[i];

cout<<nn<<endl;

cout<<t;

return 0;

}

uses crt;

const fi='kq.txt';

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

i,n:integer;

f1:text;

begin

clrscr;

n:=10;

for i:=1 to n do readln(a[i]);

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

for i:=1 to n do 

  begin

if (n%5<>0) then write(f1,a[i]:4);

else writeln(f1);

end;

close(f1);

readln;

end.

const fi='tamgiac.dat';

      fo='tamgiac.out';

var f1,f2:text;

    a,b,c,d,e,f:array[1..100]of integer;

    i,n,dem1,dem2,dem3:integer;

    ab,bc,ac:real;

begin

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

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

readln(f1,n);

for i:=1 to n do

  readln(f1,a[i],b[i],c[i],d[i],e[i],f[i]);

dem1:=0;

dem2:=0;

dem3:=0;

for i:=1 to n do

  begin

     ab:=sqrt(sqr(a[i]-c[i])+sqr(b[i]-d[i]));

     ac:=sqrt(sqr(a[i]-e[i])+sqr(b[i]-f[i]));

     bc:=sqrt(sqr(c[i]-e[i])+sqr(d[i]-f[i]));

     if (ab>0) and (ac>0) and (bc>0) and (ab+ac>bc) and (ab+bc>ac) and

(ac+bc>ab) then

        begin

           if (ab=ac) or (ac=bc) then inc(dem1);

           if ((ab=ac) and (ab<>bc) and (ac<>bc)) then inc(dem2);

           if ((ac=bc) and (bc<>ab) and (ac<>ab)) then inc(dem2);

           if ((ac=bc) and (ac<>ab) and (bc<>ab)) then inc(dem2);

           if sqr(ab)=sqr(ac)+sqr(bc) then inc(dem3);

           if sqr(ac)=sqr(bc)+sqr(ab) then inc(dem3);

           if sqr(bc)=sqr(ab)+sqr(ac) then inc(dem3);

        end;

  end;

writeln(f2,dem1);

writeln(f2,dem2);

writeln(f2,dem3);

close(f1);

close(f2);

end.