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.

7 tháng 5 2020

Program hotrotinhoc_hoc24;

var x,y,z: integer;

function max(a,b: integer): integer;

begin

max:=a;

if max<b then max:=b;

end;

begin

Write('Nhap x='); readln(x);

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

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

write('So lon nhat trong 3 so la : ',max(max(x,y),z));

readln

end.

uses crt;

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

min,n,i:integer;

{----------------chuong-trinh-con-------------------}

function nn(x,y:integer):integer;

begin

if x<y then nn:=x

else nn:=y;

end;

{-----------------chuong-trinh-chinh-----------------}

begin

clrscr;

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

for i:=1 to n do 

  begin

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

end;

min:=nn(a[1],a[2]);

for i:=3 to n do 

  if min>a[i] then min:=a[i];

writeln(min);

readln;

end.

Câu 2: 

uses crt;

var a,b:integer;

{-----------------chuong-trinh-con-------------------}

function ucln(x,y:integer):integer;

var i,uc:integer;

begin

if x<y then 

begin

uc:=1;

for i:=1 to x do 

  if (x mod i=0) and (y mod i=0) then  

begin

if uc<i then uc:=i;

end;

end

else begin

uc:=1;

for i:=1 to y do 

  if (x mod i=0) and (y mod i=0) then  

begin

if uc<i then uc:=i;

end;

end;

ucln:=uc;

end;

{--------------------------chuong-trinh-chinh------------------------}

begin

clrscr;

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

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

writeln(a,'/',b,'=',a div ucln(a,b),'/',b div ucln(a,b));

readln;

end.

Câu 1: 

const fi='songuyen.inp';

fo='tong.out';

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 eoln(f1) do 

  begin

n:=n+1;

read(f1,a[n]);

end;

t:=0;

for i:=1 to n do 

  if a[i] mod 2=0 then t:=t+a[i];

writeln(f2,t);

close(f1);

close(f2);

end.

#include <bits/stdc++.h>

using namespace std;

long long n,i,x,t;

int main()

{

cin>>n;

t=0;

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

{

cin>>x;

if (x<0) t+=x;

}

cout<<t;

return 0;

}

#include <bits/stdc++.h>

using namespace std;

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

int main()

{

cin>>n;

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

t=0;

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

cout<<t<<endl;

sort(a+1,a+n+1);

for (i=1; i<=n; i++) cout<<a[i]<<" ";

return 0;

}

10 tháng 5 2023

Program HOC24;

var t: longint;

a,b: integer;

function gt(x: integer): longint;

var i: integer; tich: longint;

begin

tich:=1;

for i:=1 to n tich:=tich*i;

gt:=tich;

end;

begin

write('Nhap a: '); readln(a);

write('Nhap b: '); readln(b);

t:=gt(a)+gt(b)+gt(a-b);

write('T = ',t);

readln

end.

10 tháng 5 2023

Program HOC24;

var i,n: integer;

t: longint;

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

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 2<>0 then t:=t+a[i];

write('Ket qua la: ',t);

readln

end.

uses crt;

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

i,n,t:integer;

begin

clrscr;

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 2=0 then t:=t+a[i];

writeln(t);

readln;

end.

uses crt;

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

i,n,min:integer;

begin

clrscr;

readln(n);

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

min:=a[1];

for i:=1 to n do 

  if min>a[i] then min:=a[i];

writeln(min);

readln;

end.

uses crt;

var a,b,c,nn:integer;

//chuongtrinhcon

function min(var x,y:integer):integer;

begin

if x<y then min:=x

else min:=y;

end;

//chuongtrinhchinh

begin

clrscr;

readln(a,b,c);

nn=min(a,b);

nn=min(nn,c);

writeln(nn);

readln;

end.

31 tháng 10 2021

#include <bits/stdc++.h>

using namespace std;

long long a,b;

int main()

{

cin>>a>>b;

cout<<max(a,b);

return 0;

}