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.
Bài 1:
#include <bits/stdc++.h>
using namespace std;
long long a[250],i,n,k;
int main()
{
cin>>n>>k;
for (i=1; i<=n; i++)
cin>>a[i];
for (i=1; i<=n; i++)
if (a[i]==k) cout<<i<<" ";
return 0;
}
Bài 1:
#include <bits/stdc++.h>
using namespace std;
long long a[250],i,n,k;
int main()
{
cin>>n>>k;
for (i=1; i<=n; i++)
cin>>a[i];
for (i=1; i<=n; i++)
if (a[i]==k) cout<<i<<" ";
return 0;
}
Bài 1:
#include <bits/stdc++.h>
using namespace std;
long long a[250],i,n,k;
int main()
{
cin>>n>>k;
for (i=1; i<=n; i++)
cin>>a[i];
for (i=1; i<=n; i++)
if (a[i]==k) cout<<i<<" ";
return 0;
}
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.
uses crt;
var a:array[1..200]of integer;
n,i,k,t,t1:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
write('Nhap k='); readln(k);
t:=0;
for i:=1 to n do
if a[i] mod 2<>0 then t:=t+a[i];
t1:=0;
for i:=1 to n do
if a[i] mod k=0 then t1:=t1+a[i];
writeln('Tong cac phan tu le la: ',t);
writeln('Tong cac phan tu la boi cua ',k,' la: ',t1);
readln;
end.
#include <bits/stdc++.h>
using namespace std;
long long x,n,i,t,dem;
int main()
{
cin>>n;
dem=0;
t=0;
for (i=1; i<=n; i++)
{
cin>>x;
if (x%2==0 && x>10) t+=x;
if (x%2!=0 || x<100) dem++;
}
cout<<t<<" "<<dem;
return 0;
}
Program HOC24;
var i,n,d,d1: integer;
a: array[1..100] of integer;
begin
write('Nhap N: '); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
d:=0; d1:=0;
for i:=1 to n do
begin
if a[i] <0 then d:=d+1;
if a[i]>0 then d1:=d1+1;
end;
writeln('Co ',d,' so duong trong mang');
write('Co ',d1,' so am trong mang');
readln
end,
uses crt;
var a:array[1..100]of integer;
n,i,k,dem,dem1:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
write('Nhap k='); readln(k);
dem:=0;
dem1:=0;
for i:=1 to n do
begin
if a[i] mod 2=0 then inc(dem);
if a[i] mod k=0 then inc(dem1);
end;
writeln('So phan tu chan la: ',dem);
writeln('So phan tu chia het cho ',k,' la: ',dem1);
readln;
end.
uses crt;
var n,i,x:integer;
a:array[1..100] of integer;
begin
clrscr;
n:=0;
repeat;
readln(x);
n:=n+1;
a[n]:=x;
until x=0;
for (i=1; i<=n; i++)
write(a[i]:4);
readln;
end.