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.
1)
var a,b : integer;
begin
writeln('nhap a va b =');
readln(a,b);
if a>b then writeln('So lon hon la a') else writeln('so lon hon la b');
if a=b then writeln('a va b bang nhau');
readln
end.
program crtg;
uses crt;
var n,i, j: integer;
A: array[1..1000] of byte;
tb: integer;
min,max: byte;
begin
clrscr;
writeln('Nhap do dai day A: '); read(n);
writeln('Nhap cac phan tu cua day: ');
for i:=1 to n do
begin
writeln('a[',i,'] = ');
repeat
read(a[i]);
until a < 100;
end;
for i:= 1 to n do
begin
if a[i] <> 1 then
begin
j:= 2;
while (a[i] mod j <> 0) do j:=j+1;
if j = a[i] then write(a[i]',');
end;
end;
tb:=0;
for i:=1 to n do
tb:=tb+a[i];
tb:=tb/n;
writeln('Gia tri trung binh cua day tren la: ',tb);
max:=a[1]; min:=a[1];
for i:=2 to n do
begin
if a[i] < min then min:=a[i];
if a[i] > max then max:=a[i];
end;
writeln('Gia tri lon nhat cua day la ',max);
writeln('Gia tri nho nhat cua day la ',min);
readln
end.
Bài 1:
uses crt;
var n,i,s:integer;
begin
clrscr;
write('Nhap n='); readln(n);
s:=0;
for i:=1 to n do
if i mod 6=0 then s:=s+i;
writeln(s);
readln;
end.
Bài 2:
uses crt;
var a,b,c,ucln,i:integer;
begin
clrscr;
write('a='); readln(a);
write('b='); readln(b);
write('c='); readln(c);
while a<>b do
begin
if a>b then a:=a-b
else b:=b-a;
end;
ucln:=a;
while ucln<>c do
begin
if ucln>c then ucln:=ucln-c
else c:=c-ucln;
end;
writeln(ucln);
readln;
end.
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n,x,y;
cout<<"Nhap n="; cin>>n;
x=n;
y=n+1;
if (x%2==0) cout<<x-2<<endl;
else cout<<x-1<<endl;
if (y%5==0) cout<<y;
else {
while (y%5!=0)
y++;
cout<<y;
}
return 0;
}