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
42. Hồ Đăng Quốc Trung....
Xem chi tiết
Quân Nguyễn
Xem chi tiết
Nguyễn Lê Phước Thịnh
23 tháng 12 2020 lúc 20:57

Câu 1: 

uses crt;

var a:array[1..500]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]<0) and (a[i] mod 7=0) then t:=t+a[i];

writeln('Tong cac so am chia het cho 7 la: ',t);

readln;

end.

Câu 2: 

uses crt;

var c,a:array[1..10]of integer;

i,kt,j,dem:integer;

begin

clrscr;

for i:=1 to 10 do 

  begin

write('C[',i,']='); readln(c[i]);

end;

dem:=0;

for i:=1 to 10 do 

  if c[i]>1 then 

begin

kt:=0;

for j:=2 to c[i]-1 do 

  if c[i] mod j=0 then kt:=1;

if kt=0 then 

begin

inc(dem);

a[dem]:=c[i];

end;

end;

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

else begin

writeln('Cac so nguyen to trong day la: ');

for i:=1 to dem do

write(a[i]:4);

end;

readln;

end.

Câu 3: 

uses crt;

var d:array[1..200]of integer;

i,k,dem:integer;

begin

clrscr;

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

for i:=1 to k do 

  begin

write('D[',i,']='); readln(d[i]);

end;

dem:=0;

for i:=1 to k do 

  if (a[i] mod 2=0) and (a[i]>=10) then inc(dem);

writeln('So phan tu chan co 2 chu so la: ',dem);

readln;

end.

lamgi hoi
Xem chi tiết
Anh Phạm
25 tháng 7 2021 lúc 14:23

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.

An An Nguyễn
Xem chi tiết
Đặng Nguyễn Hoài Băng
Xem chi tiết

#include <bits/stdc++.h>
using namespace std;
int n,x,i,cnt,res;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
cin>>n>>cnt;
for(i=0;i<n;i++)
{
    cin>>x;
    if(x%cnt==0) res++;
}
cout<<"so luong phan tu chia het cho "<<cnt<<" la: "<<res;
return 0;
}

 

 

#include <bits/stdc++.h>
using namespace std;
const int gh=1000;
int n,x,i,cnt,res,dem[gh];
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
cin>>n>>cnt;
for(i=0;i<n;i++)
{
    cin>>x;
    if(x%cnt==0) { res++; dem[res]=x;}
}
cout<<"so luong phan tu chia het cho "<<cnt<<" la: "<<res;
cout<<"\n"<<"cac phan tu do la: "<<"\n";
for(i=1;i<=res;i++)
    cout<<dem[i]<<" ";
return 0;
}

// đây mới đúng mik đọc lỗi đề nha bạn!!

Thế anh lã
Xem chi tiết
Kiều Vũ Linh
8 tháng 5 2023 lúc 8:15

Var a:array:[1..50] of integer;

i:integer;

s:longint;

Begin

For i:=1 to 50 do

Begin

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

If a[i] mod 2 <> 0 then

s:=s+a[i];

End;

Write('Tong cac so le la: ',s);

Readln

End.

lê thị thảo chi
Xem chi tiết
42. Hồ Đăng Quốc Trung....
Xem chi tiết
Phía sau một cô gái
23 tháng 4 2023 lúc 22:30

program TongLe;

var

      N, i, Tong: integer;

      A: array[1..50] of integer;

begin

      write('Nhap so phan tu cua mang N (N <= 50): ');

      readln(N);

      for i := 1 to N do

      begin

            write('Nhap phan tu thu ', i, ': ');

            readln(A[i]);

      end;

      Tong := 0;

      for i := 1 to N do

      begin

            if(A[i] mod 2 <> 0) then

            begin

                  Tong := Tong + A[i];

            end;

      end;

       writeln('Tong cac so le trong mang A la: ', Tong);

      readln;

end.

duyy
Xem chi tiết
Edward Paros
18 tháng 4 2023 lúc 22:31

program Tinh_Tong_Phan_Tu_Chan;

var
  A: array of Integer;
  N, i, sum: Integer;

begin
  Write('Nhap N: ');
  Readln(N);

  SetLength(A, N);

  // Nhập các phần tử cho mảng A
  for i := 0 to N - 1 do
  begin
    Write('Nhap phan tu thu ', i + 1, ': ');
    Readln(A[i]);
  end;

  // In lên màn hình các phần tử của mảng A
  Write('Cac phan tu cua mang la: ');
  for i := 0 to N - 1 do
  begin
    Write(A[i], ' ');
  end;
  Writeln;

  // Tính tổng các phần tử chẵn của mảng A và thông báo kết quả ra màn hình
  sum := 0;
  for i := 0 to N - 1 do
  begin
    if A[i] mod 2 = 0 then
      sum := sum + A[i];
  end;
  Writeln('Tong cac phan tu chan cua mang la: ', sum);

  Readln;
end.

Phụng Lã
Xem chi tiết
Nguyễn Lê Phước Thịnh
16 tháng 12 2022 lúc 14:42

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

}