Những câu hỏi liên quan
Anh Lê duy
Xem chi tiết
Anh Lê duy
Xem chi tiết
Nguyễn Lê Phước Thịnh
3 tháng 12 2021 lúc 22:52

#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;
}

 

Bình luận (0)
VŨ MINH HOÀNG
Xem chi tiết
my trần
Xem chi tiết
Nguyễn Lê Phước Thịnh
30 tháng 8 2021 lúc 19:15

uses crt;

var a:array[1..100]of integer;

i,n,dem,max,t,min,dem1:integer;

begin

clrscr;

write('n='); readln(n);

for i:=1 to n do 

 begin

write('A[',i,']='); readln(a[i]);

end;

dem:=0;

max:=-32000;

for i:=1 to n do 

  begin

if a[i] mod 2=0 then 

begin

dem:=dem+1;

if max<a[i] then max:=a[i];

end;

if dem=0 then writeln('Trong day khong co so chan')

else begin

writeln('So so chan la: ',dem);

writeln('So chan lon nhat la: ',max);

end;

t:=0;

for i:=1 to n do 

  if i mod 2=1 then t:=t+a[i];

writeln('Tong cac so o vi tri le la: ',t);

min:=maxint;

dem1:=0;

for i:=1 to n do 

  if a[i] mod 2<>0 then

begin  

inc(dem1);

if min>a[i] then min:=a[i];

end;

if dem1=0 then writeln('Trong day khong co so le')

else writeln('So le nho nhat la: ',min);

readln;

end. 

Bình luận (0)
Hiểu Nguyễn Đức
Xem chi tiết
Nguyễn Lê Phước Thịnh
19 tháng 5 2022 lúc 14:17

#include <bits/stdc++.h>

using namespace std;

long long a[1000],n,i,dem,t,j,t1;

int main()

{

cin>>n;

for (i=1; i<=n; i++) cin>>a[i];

for (i=1; i<=n; i++) cout<<a[i]<<" ";

cout<<endl;

dem=0;

for (i=1; i<=n; i++)

{

t=0;

for (j=1; j<=a[i]-1; j++)

if (a[i]%j==0) t+=j;

if (t==a[i]) dem++;

}

cout<<dem<<endl;

t1=0;

for (i=1; i<=n; i++)

if (a[i]%2==0) t1+=a[i];

cout<<t1;

return 0;

}

Bình luận (0)
Kudo Shinichi
25 tháng 5 2022 lúc 19:31

#include <bits/stdc++.h>

using namespace std;

long long a[1000],n,i,dem,t,j,t1;

int main()

{

cin>>n;

for (i=1; i<=n; i++) cin>>a[i];

for (i=1; i<=n; i++) cout<<a[i]<<" ";

cout<<endl;

dem=0;

for (i=1; i<=n; i++)

{

t=0;

for (j=1; j<=a[i]-1; j++)

if (a[i]%j==0) t+=j;

if (t==a[i]) dem++;

}

cout<<dem<<endl;

t1=0;

for (i=1; i<=n; i++)

if (a[i]%2==0) t1+=a[i];

cout<<t1;

return 0;

}

Bình luận (0)
Hiểu Nguyễn Đức
Xem chi tiết
Nguyễn Lê Phước Thịnh
19 tháng 5 2022 lúc 14:17

#include <bits/stdc++.h>

using namespace std;

long long a[1000],n,i,dem,t,j,t1;

int main()

{

cin>>n;

for (i=1; i<=n; i++) cin>>a[i];

for (i=1; i<=n; i++) cout<<a[i]<<" ";

cout<<endl;

dem=0;

for (i=1; i<=n; i++)

{

t=0;

for (j=1; j<=a[i]-1; j++)

if (a[i]%j==0) t+=j;

if (t==a[i]) dem++;

}

cout<<dem<<endl;

t1=0;

for (i=1; i<=n; i++)

if (a[i]%2==0) t1+=a[i];

cout<<t1;

return 0;

}

Bình luận (0)
Võ Thu Hằng
Xem chi tiết
Nguyễn Lê Phước Thịnh
8 tháng 3 2021 lúc 13:51

uses crt;

var a:array[1..1000]of integer;

i,n,dem,t:integer;

begin

clrscr;

repeat

write('Nhap n='); readln(n);

until (0<n) and (n<=1000);

for i:=1 to n do 

begin

repeat

write('A[',i,']='); readln(a[i]);

until abs(a[i])<=1000;

end;

for i:=1 to n do 

  write(a[i]:4);

writeln;

dem:=0;

for i:=1 to n do 

  if a[i]=0 then inc(dem);

writeln('So phan tu bang 0 la: ',dem);

t:=0;

for i:=1 to n do 

  if a[i] mod 2=0 then t:=t+a[i];

writeln('Tong cac phan tu chan la: ',t);

readln;

end. 

Bình luận (0)
Khánh Mỹ
Xem chi tiết
Nguyễn Lê Phước Thịnh
31 tháng 1 2021 lúc 10:17

uses crt;

var a:array[1..100]of integer;

i,n,min,dem:integer;

begin

clrscr;

write('Nhap n='); readln(n);

for i:=1 to n do

begin

write('A[',i,']='); readln(a[i]);

end;

min:=a[1];

for i:=1 to n do 

  if min>a[i] then min:=a[i];

dem:=0;

for i:=1 to n do 

  if min=a[i] then inc(dem);

writeln('So phan tu co gia tri nho nhat la: ',dem);

readln;

end.

Bình luận (0)
yuki
Xem chi tiết