Bạn chưa đăng nhập. Vui lòng đăng nhập để hỏi bài

Những câu hỏi liên quan
Bao Duong
Xem chi tiết
Nguyễn Mai
Xem chi tiết
Nguyễn Mai
Xem chi tiết
Nguyễn Lê Phước Thịnh
17 tháng 4 2023 lúc 19:25

#include <bits/stdc++.h>

using namespace std;

int B[100],n,t;

{

cin>>n;

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

t=0;

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

if (B[i]%10==0) t+=B[i];

cout<<t<<endl;

int dem=0;

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

if ((i%2==0) && (A[i]%2!=0)) dem++;

cout<<dem<<endl;

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

if ((A[i]%2!=0) && (A[i]%3==0)) cout<<A[i];

}

Kien
Xem chi tiết
Nguyễn Lê Phước Thịnh
30 tháng 10 2021 lúc 0:04

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);

writeln;

for i:=1 to n do 

  if (a[i]+a[i+1] mod 10=0) then 

begin

writeln(a[i],' ',a[i+1]);

writeln(i,' ',i+1);

end;

readln;

end.

Nguyễn Mai
Xem chi tiết
Ngô Bá Hùng
16 tháng 4 2023 lúc 10:09

program BaiToanMang;

var
  A: array[1..100] of integer;
  N, i, demChan, tongLeChia3: integer;

begin
  write('Nhap so phan tu cua mang: ');
  readln(N);
  writeln('Nhap cac phan tu cua mang: ');
  for i := 1 to N do
  begin
    write('a[', i, ']= ');
    readln(A[i]);
  end;
  tongLeChia3 := 0;
  for i := 1 to N do
  begin
    if (A[i] mod 2 = 1) and (A[i] mod 3 = 0) then
    begin
      tongLeChia3 := tongLeChia3 + A[i];
    end;
  end;
  writeln('Tong cac so le chia het cho 3: ', tongLeChia3);
  demChan := 0;
  for i := 2 to N do
  begin
    if (A[i] mod 2 = 0) and (i mod 2 = 1) then
    begin
      demChan := demChan + 1;
    end;
  end;
  writeln('So phan tu chan o vi tri le: ', demChan);
  writeln('Cac so chan chia het cho 5: ');
  for i := 1 to N do
  begin
    if (A[i] mod 2 = 0) and (A[i] mod 5 = 0) then
    begin
      write(A[i], ' ');
    end;
  end;
end.

ko bt đúng ko ko dùng pascal nhiều

Ngô Bá Hùng
16 tháng 4 2023 lúc 10:02

b dùng pascal hay python V:

Nguyễn Mai
Xem chi tiết
erddedfrferf ffvf fd
Xem chi tiết
Nguyễn Lê Phước Thịnh
15 tháng 2 2022 lúc 16:53

#include <bits/stdc++.h>

using namespace std;

long long a[1000],i,n,nn;

int main()

{

cin>>n;

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

for (i=1; i<=n; i++) if (a[i]%2!=0) cout<<i<<" ";

cout<<endl;

nn=a[1];

for (i=1; i<=n; i++) nn=min(nn,a[i]);

cout<<nn<<endl;

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

return 0;

}

Hiep Ho
Xem chi tiết
Hoan Lý
Xem chi tiết
Kiều Vũ Linh
10 tháng 5 2023 lúc 4:33

Câu 1:

var i,n:integer;

s:longint;

begin

Write('n = ');readln(n)

for i:=1 to n do

s:=s+2*i+1;

write('tong la: ',s);

readln

end.

Kiều Vũ Linh
10 tháng 5 2023 lúc 4:36

Câu 2

Bài 5:

Var b:array:[1..1000] of integer;

i,n,max:integer;

Begin

Write('n = ');readln(n);

For i:=1 to n do

Begin

Write('Nhap so thu ',i,' = ');readln(b[i]);

End;

Write('Cac phan tu am la: ');

For i:=1 to n dko

if b[i]<0 then write(b[i]:8);

writeln;

max:=b[1];

For i:=2 to n do

If b[i] > max then max:=b[i];

write('So lon nhat la ',max);

Readln

End.