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.
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.
Câu 1:
uses crt;
var k,i:integer;
begin
clrscr;
write('Nhap k='); readln(k);
for i:=1 to k do
write(i:4);
readln;
end.
Câu 2:
uses crt;
var a:array[1..100]of integer;
i,n,t:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
t:=0;
for i:=1 to n do
t:=t+a[i];
writeln('Tong cac gia tri cua day la: ',t);
readln;
end.
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;
int n=10,i,x,t;
int main()
{
t=0;
for (i=1; i<=n; i++)
{
cin>>x;
t+=x;
}
cout<<t;
}
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.
uses crt;
var a:array[1..100]of integer;
n,i,dem,dem1:integer;
begin
clrscr;
repeat
write('nhap n='); readln(n);
if n<=0 then writeln('ban da nhap sai, yeu cau ban nhap lai');
until n>0;
for i:=1 to n do
begin
write('a[',i,']='); readln(a[i]);
end;
{-------------------cau-b-------------------}
for i:=1 to n do
write(a[i]:4);
{-------------cau-c----------------------}
writeln;
dem:=0;
writeln('nhung phan tu chia het cho 3 trong day la: ');
for i:=1 to n do
if a[i] mod 3=0 then
begin
write(a[i]:4);
inc(dem);
end;
writeln;
writeln('so phan tu chia het cho 3 trong day la: ',dem);
{----------------cau-d--------------------------------}
dem1:=0;
writeln('nhung phan tu lon hon 10 trong day la: ');
for i:=1 to n do
if a[i]>10 then
begin
write(a[i]:4);
dem1:=dem1+1;
end;
writeln;
writeln('so phan tu lon hon 10 trong day la: ',dem1);
readln;
end.
#include <bits/stdc++.h>
using namespace std;
long long nn,i,x,n;
int main()
{
cin>>n;
nn=LLONG_MAX;
for (i=1; i<=n; i++)
{
cin>>x;
nn=min(nn,x);
}
cout<<nn;
return 0;
}
program bai1;
uses crt;
var i,n,T:longint;
A:array[1..10000] of longint;
begin
write('do dai cua day so,n='); readln(n);
write('nhap cac phan tu cua day so:');
for i:=1 to n do
begin
write('a[',i,']='); readln(a[i]);
end;
T:=0;
for i:=1 to n do T:=T+a[i];
write('tong la:',T);
readln
end.