K
Khách

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.

13 tháng 6 2021

Đề thi tin học trẻ BT phải ko b?

Mà bài này giải sao nhỉ?

Muốn xem code để tham khảo quá!!!

30 tháng 7 2021

sắp xếp lại các phần tử theo chiều tăng dần rồi đặt kết quả muốn tìm = 1, so sánh nó với từng phần tử trong mảng, nếu bé hơn thì dừng chương trình và đó là kết quả, nếu không thỉ cộng kết quả cho phần tử đang được so sánh.

code :

program giai;uses crt;var n,m,i,c,t : integer;A : array[1..100] of integer;beginclrscr;write('so phan tu cua day so :');readln(m);for i:=1 to m do    begin         readln(A[i]);    end;for i:= 1 to m do    for n:=i+1 to m do        if A[i] > A[n] then        begin        c:= A[i];        A[i] := A[n];        A[n] := c;        end;t:= 1;for i:=1 to m-1 do    if t < A[i]    then    break    else t:= t+ A[i];writeln(t);readln;end. 

uses crt;

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

i,n,dem,dem1,dem2,t:integer;

s:real;

begin

clrscr;

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

for i:=1 to n do 

begin

repeat

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

until a[i]>0;

end;

for i:=1 to n do 

  write(a[i]:4);

writeln;

dem:=0;

for i:=1 to n do

  if a[i]>10 then inc(dem);

writeln('So phan tu lon hon 10 la: ',dem);

dem1:=0;

dem2:=0;

for i:=1 to n do 

begin

if a[i] mod 2=0 then inc(dem1)

else inc(dem2);

end;

writeln('So luong so chan la: ',dem1);

writeln('So luong so le la: ',dem2);

t:=0;

s:=1;

for i:=1 to n do 

  begin

if (i mod 2=0) and (a[i] mod 2<>1) then t:=t+a[i];

if (i mod 2=1) and (a[i] mod 2=0) then s:=s*a[i];

end;

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

writeln('Tich cac so o vi tri le co gia tri chan la: ',s:4:2);

writeln('Cac so le la: ');

for i:=1 to n do 

  if a[i] mod 2<>0 then write(a[i]:4);

writeln;

writeln('Cac so chan va lon hon 10 la: ');

for i:=1 to n do 

  if (a[i] mod 2=0) and (a[i]>10) then write(a[i]:4);

readln;

end.

18 tháng 2 2021

Thank you

#include <bits/stdc++.h>

using namespace std;

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

bool kt;

int main()

{

freopen("nguyento.inp","r",stdin);

freopen("nguyento.out","w",stdout);

cin>>n;

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

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

if (a[i]>1) 

{

kt=true;

for (j=2; j*j<=a[i]; j++)

if (a[i]%j==0) kt=false;

if (kt==true) cout<<a[i]<<" ";

}

return 0;

}

29 tháng 12 2020

phần a

29 tháng 12 2020

phần b

27 tháng 7 2017