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;
n,i,max,min,t:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
max:=a[1];
for i:=1 to n do
if max<a[i] then max:=a[i];
min:=a[1];
for i:=1 to n do
if min>a[i] then min:=a[i];
t:=0;
for i:=1 to n do
t:=t+a[i];
writeln('Gia tri lon nhat la: ',max);
writeln('Gia tri nho nhat la: ',min);
writeln('Trung binh cua day so la: ',t/n:4:2);
readln;
end.
#include <bits/stdc++.h>
using namespace std;
long long a[1000],i,n,dem;
int main()
{
cin>>n;
for (i=1; i<=n; i++) cout<<a[i]<<" ";
cout<<endl;
dem=0;
for (i=1; i<=n; i++)
if (a[i]%2!=0) dem++;
cout<<dem;
return 0;
}
#include <bits/stdc++.h>
using namespace std;
long long a[1000],i,n,dem;
int main()
{
cin>>n;
for (i=1; i<=n; i++) cin>>a[i];
for (i=1; i<=n; i++)
cout<<a[i]<<" ";
cout<<endl;
dem=0;
for (i=1; i<=n; i++)
if (a[i]%2==0) dem++;
cout<<dem;
return 0;
}
Câu 1:
uses crt;
var n,i,kt:integer;
begin
clrscr;
write('Nhap n='); readln(n);
if n<2 then writeln(n,' khong la so nguyen to')
else begin
kt:=0;
for i:=2 to n-1 do
if n mod i=0 then kt:=1;
if kt=0 then writeln(n,' la so nguyen to')
else writeln(n,' khong la so nguyen to');
end;
readln;
end.
Câu 2:
uses crt;
var a:array[1..100]of integer;
i,n,max,min:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
max:=a[1];
min:=a[1];
for i:=1 to n do
begin
if max<a[i] then max:=a[i];
if min>a[i] then min:=a[i];
end;
writeln('So lon nhat la: ',max);
writeln('So nho nhat la: ',min);
readln;
end.
program bai_5;
uses crt;
var a,b,c :real;
BEGIN
write('nhap vao so a'); Readln(a);
write('nhap vao so b'); Readln(b);
write('nhap vao so c'); Readln(c);
if a<0 then a:=-a;
max:=a;
if max <b then max:=b;
if max<c then max:=c;
write('gia tri tuyet doi cua a la:',a);
write('so lon nhat trong ba so a,b,c la:',max);
Readln
END.
Thanks
uses crt;
var a:array[1..100]of integer;
n,i:integer;
begin
clrscr;
repeat
write('Nhap n='); readln(n);
if n<=0 then writeln('Ban nhap sai, yeu cau nhap lai');
until n>0;
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
for i:=1 to n do
if a[i] mod 2=0 then write(a[i]:4);
readln;
end.
#include <bits/stdc++.h>
using namespace std;
long long a,b;
int main()
{
cin>>a>>b;
cout<<a-b;
return 0;
}
Program HOC24;
var a,b,c,max: integer;
begin
write('Nhap a: '); readln(a);
write('Nhap b: '); readln(b);
write('Nhap c: '); readln(c);
max:=a;
if b>max then max:=b;
if c>max then max:=c;
writeln('So lon nhat la: ',max);
readln
end.
Var a,b,c,min:real;
Begin
Write('a = ');readln(a);
Write('b = ');readln(b);
Write('c = ');readln(c);
min:=a;
If b < min then min:=b;
If c < min then min:=c;
Write('So nho nhat la ',min:10:2);
Readln
End.