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..50]of integer;
m,n,t,min,vt:integer;
begin
clrscr;
write('Nhap m='); readln(m);
for i:=1 to m do
begin
write('A[',i,']='); readln(a[i]);
end;
for i:=1 to m do
write(a[i]:4);
writeln;
t:=0;
for i:=1 to m do
t:=t+a[i];
writeln('Tong cac phan tu la: ',t);
min:=a[1];
for i:=1 to n do
if min>a[i] then min:=a[i];
vt:=0;
for i:=1 to n do
if min=a[i] then inc(vt);
writeln('So nho nhat la: ',min);
writeln('So lan xuat hien la: ',vt);
readln;
end.
#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;
}
Câu 4:
#include <bits/stdc++.h>
using namespace std;
string st;
int d,i,dem;
char x;
int main()
{
getline(cin,st);
d=st.length();
cout<<st<<endl;
cin>>x;
dem=0;
for (i=0; i<=d-1; i++) if (st[i]==x) dem++;
cout<<dem;
return 0;
}
Câu 4:
#include <bits/stdc++.h>
using namespace std;
string st;
int d,i,dem;
char x;
int main()
{
getline(cin,st);
d=st.length();
cout<<st<<endl;
cin>>x;
dem=0;
for (i=0; i<=d-1; i++) if (st[i]==x) dem++;
cout<<dem;
return 0;
}
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 <iostream>
using namespace std;
int main()
{
int a[100][100],i,j,m,n;
cout<<"Nhap so dong cua mang:"; cin>>n;
cout<<"Nhap so cot cua mang:"; cin>>m;
for (i=1; i<=n; i++)
for (j=1; j<=m; j++)
{
cout<<"A["<<i<<","<<j<<"]="; cin>>a[i][j];
}
for (i=1; i<=n; i++)
{
for (j=1; j<=m; j++)
cout<<a[i][j]<<" ";
cout<<endl;
}
return 0;
}
Câu 1:
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 so trong mang la: ',t);
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
if a[i] mod 2=0 then t:=t+a[i];
writeln('Tong cac so chan la: ',t);
readln;
end.
a
#include <bits/stdc++.h>
using namespace std;
long long a[1000],i,n;
int main()
{
cin>>n;
for (i=1; i<=n; i++) cin>>a[i];
for (i=1; i<=n; i++) cout<<a[i]<<" ";
return 0;
}