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.

const fi='input.txt';

fo='output.txt';

var f1,f2:text;

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

n,i,dem:integer;

begin

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

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

n:=0;

while not eoln(f1) do

begin

inc(n);

read(f1,a[n]);

end;

dem:=0;

for i:=1 to n do

if a[i]<0 then inc(dem);

writeln(f2,dem);

close(f1);

close(f2);

end.

28 tháng 5 2020

Program HOC24;

const fi='inp.txt';

fo='output.txt';

var f: text;

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

i,n,d: integer;

procedure ip;

begin

assign(f,fi);

reset(f);

n:=0;

while not(eof(f)) do

begin

n:=n+1;

read(f,a[n]);

end;

close(f);

end;

procedure out;

begin

assign(f,fo);

rewrite(f);

d:=0;

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

write(f,d);

close(f);

end;

begin

ip;

out;

end.

const fi='input.txt';

fo='output.txt';

var f1,f2:text;

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

i,n,t:integer;

begin

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

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

n:=0;

while not eof(f1) do 

begin

inc(n);

read(f1,a[n]);

end;

t:=0;

for i:=1 to n do t:=t+a[i];

write(f2,t);

close(f1);

close(f2);

end.

const fi='dataln.txt';

fo='dataout.txt';

var f1,f2:text;

x,i,t:integer;

begin

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

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

t:=0;

for i:=1 to 24 do 

begin

read(f1,x);

t:=t+x;

end;

writeln(f2,t);

close(f1);

close(f2);

end.

uses crt;

const fi='input.txt';

var f1:text;

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

    i,n:integer;

begin

clrscr;

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

n:=0;

while not eof(f1) do

  begin

     n:=n+1;

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

  end;

for i:=1 to n do

  writeln('Tong cua dong ',i,' la: ',a[i]+b[i]+c[i]:4:2);

for i:=1 to n do

  writeln('Trung binh cong cua dong ',i,' la: ',(a[i]+b[i]+c[i])/3:4:2);

close(f1);

readln;

end.

uses crt;

const fi='so.inp';

var f1:text;

a,b:integer;

begin

clrscr;

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

while not eof(f1) do 

 begin

readln(f1,a,b);

writeln((a+b)/2:4:2);

end;

close(f1);

readln;

end.

#include <bits/stdc++.h>
using namespace std;
unsigned long long a[1000],i,n,uc;
//chuongtrinhcon
unsigned long long ucln(long long a,long long b)
{
    if (b==0) return(a);
    else return(ucln(b,a%b));
}
//chuongtrinhchinh
int main()
{
    freopen("sn3.inp","r",stdin);
    freopen("uc.out","w",stdout);
    cin>>n;

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

uc=ucln(a[1],a[2]);

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

uc=ucln(uc,a[i]);

cout<<uc;
    return 0;
}

 

13 tháng 3 2022

nhờ viết thành pascal hộ nhé

#include <bits/stdc++.h>

using namespace std;

long long a[10],b[10],i,j;

int main()

{

freopen("input.txt","r",stdin);

freopen("output.txt","w",stdout);

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

for (j=1; j<=10; j++) cin>>b[j];

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

cout<<a[i]+b[i]<<" ";

return 0;

}