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:array[1..100]of integer;
i,n,t:integer;
begin
clrscr;
readln(n);
for i:=1 to n do readln(a[i]);
for i:=1 to n do write(a[i]:4);
writeln;
for i:=1 to n do
if (a[i] mod 2<>0) then write(a[i]:4);
writeln;
t:=0;
for i:=1 to n do t:=t+a[i];
writeln(t);
writeln(t/n:4:2);
readln;
end.
Câu 2:
Program nii;
Uses crt;
Var a,b,c,A:integer;
Begin
Write ('nhap a');
Readln (a);
Write ('nhap b');
Readln (b);
Write ('nhap c');
Readln (c);
A:=a;
If A<b then A:=b;
If A<c then A:=c;
Write ('Ket qua',A);
Readln;
End.
Câu 1
Program ntg;
Uses crt;
Var A,x,y:integer;
Begin
Write ('nhap x');
Readln (x);
Write ('nhap y');
Readln ('y');
A:=x+y;
Write ('Ket qua',A);
Readln;
End.
uses crt;
var n,i,t,s:integer;
begin
clrscr;
repeat
readln(n);
until n<>0;
t:=0;
for i:=1 to n do if i mod 2=0 then t:=t+i;
writeln(t);
s:=1;
for i:=1 to n do
if i mod 2=1 then s:=s*i;
writeln(s);
readln;
end.
Bài 2:
#include <bits/stdc++.h>
using namespace std;
long long x,y;
int main()
{
cin >>x>>y;
cout<<x<<" "<<y;
swap(x,y);
cout<<x<<" "<<y;
return 0;
}
-so sanh hai so nhap tu ban phim:
var a,b:integer;
begin
clrscr;
write('Nhap so thu nhat:');readln(a);
write('Nhap so thu hai:');readln(b);
if a>b then writeln(a,'lon hon',b)
else writeln(a,'nho hon,'b);
if a=b then writeln(a,'bang',b);
readln;
end.
program ctdt;
uses crt;
type mang=array[1..10]of integer;
var a,b,min,x,y,i,j,tam:integer;
t,t1:mang;
(*------------------------*)
BEGIN
clrscr;
(*cau a*)
write('nhap 2 so:');readln(a,b);
if a>b then writeln(a,' lon hon ',b);
if a=b then writeln(a,' bang ',b);
if a<b then writeln(a,' nho thua ,b);
(*cau b*)
for i:=1 to 4 do {dua 4 so vao 1 mang}
begin
write(so thu ',i,' :');readln(t[i]);
end;
min:=t[1];
for i:=2 to 4 do
if t[i]<min then min:=t[i];
writeln('so nho nhat trong bon so:',min);
(*cau c*)
write('nhap hai so x,y:');readln(x,y);
if x>y then
begin
tam:=x;
x:=y;
y:=tam;
end;
(*cau d*)
for i:=1 to 3 do {dua 3 so vao mot mang}
begin
write(' so thu ',i,': ');readln(t1[i]);
end;
for i:=1 to 3-1 do
for j:=i+1 to 3 do
if t1[j]>t1[i] then
begin
tam:=t1[j];
t1[j]:=t1[i];
t1[i]:=tam;
end;
for i:=1 to 3 do
write(t1[i]);
readln;
end.
bai nay con vai loi sai nho
ban nen chay tung cau mot va khoa cac cau con lai bang lenh {...}
Var a:array:[1..1000] of integer;
i,n,max:integer;
Begin
Write('Nhap so luong phan tu n = ');readln(n);
For i:=1 to n do
Begin
Write('Nhap diem thu ',i,' = ');readln(a[i]);
End;
Write('Cac diem vua nhap la: ');
For i:=1 to n do
Write(a[i]:8);
writeln;
max:=a[1];
For i:=2 to n do
if a[i] > max then max:=a[i];
write('So lon nhat la ',max);
Readln
End.
câu 1
uses crt;
var a,b,c,kt,kt1:integer;
tbc1,tbc2,tbc3:real;
begin
clrscr;
write('a='); readln(a);
write('b='); readln(b);
write('c='); readln(c);
{-------------------------------cau-a----------------------}
if (a>b) and (a>c) then
begin
write(a,' ');
if b>c then write(b,' ',c);
if b<c then write(c,' ',b);
end;
if (b>a) and (b>c) then
begin
write(b,' ');
if a>c then write(a,' ',c);
if a<c then write(c,' ',a);
end;
if (c>a) and (c>b) then
begin
write(c,' ');
if a>b then write(a,' ',b);
if a<b then write(b,' ',a);
end;
{--------------------------cau-b-------------------------}
writeln;
kt:=0;
tbc1:=(a+b)/2;
tbc2:=(b+c)/2;
tbc3:=(c+a)/2;
if tbc1=c then
begin
kt:=1;
writeln(c);
end;
if tbc2=a then
begin
kt:=1;
writeln(a);
end;
if tbc3=b then
begin
kt:=1;
writeln(b);
end;
if kt=0 then writeln('NO');
{--------------------cau-c-------------------------------}
writeln;
if (a+b>c) and (a+c>b) and (b+c>a) then
begin
kt1:=0;
if sqr(c)=sqr(a)+sqr(b) then
begin
kt1:=1;
writeln(c);
end;
if sqr(a)=sqr(b)+sqr(c) then
begin
kt1:=1;
writeln(a);
end;
if sqr(b)=sqr(a)+sqr(c) then
begin
kt1:=1;
writeln(b);
end;
if kt1=0 then writeln('NO');
end
else writeln('day khong phai la 3 canh trong 1 tam giac');
readln;
end.