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:integer;
begin
clrscr;
write('Nhap a='); readln(a);
if a<0 then writeln(a,' la so am')
else if a>0 then writeln(a,' la so duong')
else writeln(a,' khong la so am cung khong la so duong');
readln;
end.
var A: integer;
begin
write('Nhap vao mot so A='); readln(A);
if A>0 then write('So A la so nguyen duong');
if A<0 then write('So A la so nguyen am');
If A=0 then write('So A khong la so nguyen am va khong la so nguyen duong');
readln;
end.
program trungbinh;
uses crt;
var n,i: integer;
s:real;
A: array[1..1000] of integer;
begin
clrscr;
write('Nhap do dai day: '); readln(n);
writeln('Nhap gia tri cua day: ');
S:=0;
for i:=1 to n do
begin
write('A[',i,']= ');
readln(A[i]);
S:=S+A[i];
end;
S:=S/n;
write('Trung binh cua cac so cua day do la: ',S);
readln;
end.
Program bt;
Uses crt;
Var i, n: Integer;
begin
clrscr;
Write('Nhap n='); Read(n);
For i:=1 to n do if n mod 2=0 write('cac so tu 1 den n la',i,');
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;
}
program Le_Nho_Hon_Hoac_Bang_n;
uses crt;
var
n, i: integer;
begin
clrscr;
write('Nhap vao mot so nguyen duong n: ');
readln(n);
while n <= 0 do
begin
writeln('So ban nhap khong hop le. Xin vui long nhap lai: ');
readln(n);
end;
clrscr;
writeln('Cac so le nho hon hoac bang ', n, ' la:');
i := 1;
while i <= n do
begin
if i mod 2 <> 0 then
writeln(i);
i := i + 1;
end;
readln;
end.
uses crt;
var a,b,c,max:integer;
begin
clrscr;
write('nhap ba so:');readln(a,b,c);
if a mod 2=0 then writeln(a,' la so chan')
else writeln(a,'la so le);
if b mod 2=0 then writeln(b,'la so chan')
else writeln(b,'la so le');
if c mod 2=0 then writeln(c,'la so chan')
else writeln(c,'la so le');
max:=a;
if max<b then max:=b;
if max<c then max:=c;
writeln('so lon nhat trong ba so la:',max);
readln
end.
program so_le;
uses crt;
var
n,i,d:integer;
a:Array[1..32000] of integer;
begin
clrscr;
write('nhap n: ');
readln(n);
for i:= 1 to n do
begin
write('nhap a[',i,']: ');
readln(a[i]);
end;
d:=0;
for i:= 1 to n do
if a[i] mod 2 <> 0 then d:=d+1;
write('so luong so nguyen la so le la: ',d);
readln;
end.
SOS:)