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.
cau 1:
uses crt;
var a:array[1..100] of integer;
n,i,min: integer;
begin
readln(n);
for i:=1 to n do
readln(a[i]);
min:=a[1];
for i:=2 to n do
if min>a[i] then min=a[i];
writeln(a[i]);
readln;
end.
cau 2:
uses crt;
g:text;
s:string;
const fo='CHUSO.TXT';
begin
assign(g,fo);
rewrite(g);
readln(s);
for i:=1 to length(s) do
if not((s[i] in ['a'..'z'])and(s[i] in ['A'..'Z])) then delete(s,i,1);
writeln(g,s);
end.
6:
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n,A[100],i,dem=0;
cin>>n;
for (int i=1; i<=n; i++) cin>>A[i];
for (int i=1;i<=n; i++)
if (A[i]%2!=0) dem++;
cout<<dem;
return 0;
}
5:
#include <bits/stdc++.h>
using namespace std;
int main()
{
long long n,nn=1e6,A[1000];
cin>>n;
for (int i=1; i<=n; i++) cin>>A[i];
for (int i=1; i<=n; i++)
nn=min(nn,A[i]);
for (int i=1; i<=n; i++)
if (nn==A[i]) cout<<i<<" ";
return 0;
}
#include <bits/stdc++.h>
using namespace std;
long long a[40],i,n,ln;
int main()
{
cin>>n;
for (i=1; i<=n; i++)
{
cin>>a[i];
}
ln=a[1];
for (i=1; i<=n; i++) ln=max(ln,a[i]);
for (i=n; i>=1; i--)
if (ln==a[i])
{
cout<<i;
break;
}
return 0;
}
#include <bits/stdc++.h>
using namespace std;
long long n,i,a[10000];
int main()
{
cin>>n;
for (i=1; i<=n; i++)
cin>>a[i];
for (i=1; i<=n; i++) cout<<a[i]<<" ";
return 0;
}
#include <bits/stdc++.h>
using namespace std;
long long a[10000],n,i,t;
int main()
{
cin>>n;
t=0;
for (i=1; i<=n; i++)
{
cin>>a[i];
t=t+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<<endl;
cout<<t;
return 0;
}
uses crt;
var C : array [1 .. 50] of integer;
i, n : integer;
begin
clrscr;
write('Nhap so phan tu : '); readln(n);
write('Nhap day gom ', n ,' so : ');
for i := 1 to n do read(C[i]);
write('Cac gia tri chan : ');
for i := 1 to n do
if C[i] mod 2 = 0 then write(C[i], ' ');
readln
end.
var a:array[1..100] of integer;
i,n,S,d:byte;
begin
write(' n = '); readln(n);
for i:=1 to n do begin
write('A[',i,'] = ');
readln(A[i]);
end;
d:=0; S:=0;
for i:=1 to n do if A[i] mod 2 = 0 then begin
d:=d+1;
S:=S+A[i];
end;
write('Dãy có ',d,' phần tử là số chẵn và tổng của chúng là : S = ',S);
readln
end.
#include <bits/stdc++.h>
using namespace std;
long long a[100],n,i,t,t1,dem,dem1;
//chuongtrinhcon
bool ktnt(long long x)
{
if (x<=1) return(false);
for (int i=2; i*i<=x; i++)
if (x%i==0) return(false);
return true;
}
//chuongtrinhchinh
int main()
{
cin>>n;
for (i=1; i<=n; i++)
{
cin>>a[i];
}
for (i=1; i<=n; i++) cout<<a[i]<<" ";
cout<<endl;
t=0;
for (i=1; i<=n; i++) if (a[i]%2==0) t=t+a[i];
cout<<t<<endl;
dem=0;
for (i=1; i<=n; i++) if (a[i]%3==0) dem++;
cout<<dem<<" ";
t1=0;
dem1=0;
for (i=1; i<=n; i++)
if (a[i]%2!=0)
{
t1+=a[i];
dem1++;
}
cout<<fixed<<setprecision(2)<<(t1*1.0)/(dem1*1.0)<<endl;
for (i=1; i<=n; i++)
if (ktnt(a[i])==true) cout<<a[i]<<" ";
return 0;
}
#include <bits/stdc++.h>
using namespace std;
int A[500],n,i,dem,dem1;
int main()
{
cin>>n;
for (int i=1; i<=n; i++) cin>>A[i];
for (int i=n; i>=1; i--) cout<<A[i]<<" ";
cout<<endl;
dem=0;
for (int i=1; i<=n; i++)
if (A[i]<10) dem++;
cout<<dem<<endl;
dem1=0;
for (int i=1; i<=n; i++)
if (A[i]>1)
{
bool kt=true;
for (int j=2; j*j<=A[i]; j++)
if (A[i]%j==0) kt=false;
if (kt==true) dem1++;
}
cout<<dem1;
return 0;
}
Câu 1:
uses crt;
var b:array[1..100]of integer;
m,i:integer;
begin
clrscr;
write('nhap m='); readln(m);
for i:=1 to m do
begin
write('b[',i,']='); readln(b[i]);
end;
writeln('cac so chan va la boi cua 4 la: ');
for i:=1 to m do
if (b[i] mod 2=0) and (b[i] mod 4=0) then write(b[i]:4);
readln;
end.
Câu 2:
uses crt;
var s:string;
d,kt,i:integer;
begin
clrscr;
write('nhap xau S:'); readln(s);
d:=length(s);
kt:=0;
for i:=1 to d do
if (s[i] in ['A'..'Z']) or (s[i] in ['a'..'z']) then
begin
kt:=1;
write(s[i]:4);
end;
if kt=0 then writeln('Khong co ky tu nao la chu cai trong xau');
readln;
end.