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:
#include <bits/stdc++.h>
using namespace std;
long long n=10, a[10],i,nn;
int main()
{
for (i=1; i<=n; i++) cin>>a[i];
nn=a[1];
for (i=2; i<=n; i++) nn=min(nn,a[i]);
cout<<nn;
return 0;
}
Program Tin_hoc;
Uses crt;
Var i,n,dem:integer;
a:array[1..100000] of integer;
Begin
clrscr;
Write('Nhap 1 so nguyen duong n: ');readln(n);
dem:=0;
Writeln('Nhap ',n,' phan tu:');
For i:= 1 to n do
Begin
Write('A[',i,'] = ');
readln(a[i]);
If a[i] mod 2 = 0 then inc(dem);
End;
Writeln('Day vua nhap la:');
For i:= 1 to n do write(a[i],' ');writeln;
Writeln('Day so vua nhap co ',dem,' so chan');
readln;
End.
uses crt;
var a:array[1..100]of integer;
i,n,dem:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
for i:=1 to n do
write(a[i]:4);
writeln;
dem:=0;
for i:=1 to n do
if a[i] mod 2=0 then inc(dem);
writeln('So so chan la: ',dem);
readln;
end.
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
if a[i] mod 2<>0 then t:=t+a[i];
writeln(t);
readln;
end.
uses crt;
var a: array[1..100] of integer;
i: longint;
begin
clrscr;
for i:=1 to 20 do readln(a[i]);
writeln('day vua nhap la:');
for i:=1 to 20 do write(a[i],' ');
readln
end.
uses crt;
var a:array[1..20]of integer;
i,n:integer;
begin
clrscr;
n:=20;
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
for i:=1 to n do
write(a[i]:4);
readln;
end.
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
if a[i]>0 then t:=t+a[i];
writeln(t);
readln;
end.
uses crt;
var a:array[1..20]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;
for i:=1 to n do
write(a[i]:4);
writeln;
t:=0;
for i:=1 to n do
t:=t+a[i];
writeln('Tong cua day la: ',t);
for i:=1 to n do
if a[i]>50 then write(a[i]:4);
writeln;
for i:=1 to n do
if a[i]<30 then write(a[i]:4);
readln;
end.
#include <bits/stdc++.h>
using namespace std;
int n,x,i,cnt,res;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
cin>>n>>cnt;
for(i=0;i<n;i++)
{
cin>>x;
if(x%cnt==0) res++;
}
cout<<"so luong phan tu chia het cho "<<cnt<<" la: "<<res;
return 0;
}
#include <bits/stdc++.h>
using namespace std;
const int gh=1000;
int n,x,i,cnt,res,dem[gh];
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
cin>>n>>cnt;
for(i=0;i<n;i++)
{
cin>>x;
if(x%cnt==0) { res++; dem[res]=x;}
}
cout<<"so luong phan tu chia het cho "<<cnt<<" la: "<<res;
cout<<"\n"<<"cac phan tu do la: "<<"\n";
for(i=1;i<=res;i++)
cout<<dem[i]<<" ";
return 0;
}
// đây mới đúng mik đọc lỗi đề nha bạn!!
uses crt;
var a:array[1..100]of integer;
i,n:integer;
begin
clrscr;
readln(n);
for i:=1 to n do readln(a[i]);
for i:=1 to n do write(a[i]:4);
readln;
end.
#include <bits/stdc++.h>
using namespace std;
long long a[100],n,i,s,t,ln,nn;
int main()
{
cin>>n;
for (i=1; i<=n; i++)
cin>>a[i];
s=1;
t=0;
ln=a[1];
nn=a[1];
for (i=1; i<=n; i++)
{
s=s*a[i];
t+=a[i];
ln=max(ln,a[i]);
nn=min(nn,a[i]);
}
cout<<s<<endl;
cout<<t<<endl;
cout<<ln<<endl;
cout<<nn;
return 0;
}
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:=1;
for i:=1 to n do
t:=t*a[i];
writeln(t);
readln;
end.