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.
uses crt;
var a,b:integer;
{-------------chuong-trinh-con-tinh-tong---------------------}
function tong(x,y:integer):integer;
begin
tong:=x+y;
end;
{-------------chuong-trinh-con-tinh-tich------------------}
function tich(x,y:integer):integer;
begin
tich:=x*y;
end;
{-----------------chuong-trinh-con-so-lon------------------}
function solon(x,y:integer):integer;
begin
if x>y then solon:=x
else solon:=y;
end;
{-----------------chuong-trinh-con-so-be------------------}
function sobe(x,y:integer):integer;
begin
if x<y then sobe:=x
else sobe:=y;
end;
{--------------------chuong-trinh-chinh-----------------}
begin
clrscr;
write('Nhap a='); readln(a);
write('Nhap b='); readln(b);
writeln('Tong la: ',tong(a,b));
writeln('Tich la: ',tich(a,b));
writeln('So lon la: ',solon(a,b));
writeln('So be la: ',sobe(a,b));
readln;
end.
uses crt;
const fi='baitap.txt';
var f1:text;
x,y:integer;
begin
clrscr;
assign(f1,fi); reset(f1);
readln(f1,x,y);
writeln(sqrt(x*x+y*y):4:2);
close(f1);
readln;
end.
program zoo;
var
i,n,k,d:integer;
a:array[1..32000] of integer;
function hello(x,y:integer):boolean;
begin
hello:=false;
if x mod y = 0 then hello := true
end;
begin
write(' nhap n: '); readln(n);
for i:= 1 to n do
begin
write(' nhap a[',i,'] = '); readln(a[i]);
end;
write(' nhap k = '); readln(k);
d:=0;
for i:= 1 to n do
if hello(a[i],k) = true then d:=d+1;
write(' so luong so chia het cho k la : ',d);
readln;
end.
const fi='k.inp';
fo='k.out';
var
i,n,k,d:integer;
a:Array[1..32000] of integer;
begin
assign(f,fi);
reset(f);
readln(f,n);
for i:= 1 to n do
read(f,a[i]);
readln(f);
read(f,k);
close(f);
assign(f,fO);
rewrite(f);
d:=0;
for i:= 1 to n do
if a[i] mod k = 0 then inc(d);
write(f,' co ',d,'so chia het cho',k);
close(f);
end.
#include <bits/stdc++.h>
using namespace std;
string a,b;
int d1,d2;
int main()
{
cin>>a>>b;
d1=a.length();
d2=b.length();
if (d1%2==0) cout<<a<<" ";
if (d2%2==0) cout<<b<<" ";
return 0;
}
Bài 1:
function canbac2(x:longint):real;
begin
canbac2:=sqrt(x);
end;
Bài 2:
function tong(n:longint):longint;
var s,i:longint;
begin
s:=0;
for i:=1 to n do
s:=s+i;
tong:=s;
end;