Những câu hỏi liên quan
Thuy Ngan
Xem chi tiết
datcoder
24 tháng 12 2023 lúc 12:48

Program HOC24;

var i,n: byte;

t: longint;

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

begin

write('Nhap N: '); readln(n);

for i:=1 to n do 

begin

write('Nhap so thu ',i,': '); readln(a[i]);

end;

t:=0;

for i:=1 to n do 

if a[i]>10 then t:=t+a[i];

writeln('Tong cac so lon hon 10 la: ',t);

readln

end.

Bình luận (0)
Vinh Thái
Xem chi tiết
Nguyễn Lê Phước Thịnh
21 tháng 4 2021 lúc 21:25

uses crt;

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

i,n,t,dem: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 6=0 then t:=t+a[i];

writeln('Tong cac so chia het cho 3 va 6 la: ',t);

for i:=1 to n do 

  if a[i]>3 then write(a[i]:4);

writeln;

for i:=1 to n do 

  write(a[i]:4);

dem:=0;

for i:=1 to n do 

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

writeln(dem);

readln;

end.

Bình luận (1)
Khánh Linh
Xem chi tiết
Nguyễn Lê Phước Thịnh
26 tháng 2 2022 lúc 22:53

Bài 2: 

#include <bits/stdc++.h>

using namespace std;

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

int main()

{

cin>>n;

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

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

cout<<endl;

ln=a[1];

nn=a[1];

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

{

ln=max(ln,a[i]);

nn=min(nn,a[i]);

}

cout<<ln<<" "<<nn;

}

Bình luận (0)
Lê Bích Thủy
Xem chi tiết
Đỗ Tuệ Lâm
17 tháng 2 2022 lúc 14:08

{PROGRAM Bai_tap1;
USES crt;
VAR n, i, C, L:Bytbe;
BEGIN 
  clrscr;
  Write('Nhap n:');Readln(n);
  C:=0;L:=0;
  For i:=1 to n do
    If i mod 2=0 then C:=C+i else L:=L+i;
  writeln('Tong cac so chan la:',C);
  writeln ('Tong cac so le la:',L);
  Readln;
end.  
}

Bình luận (0)
Wasel TV
Xem chi tiết
Phía sau một cô gái
31 tháng 3 2023 lúc 20:22

program tinhTong;

var

     n,i,s: integer;

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

begin

     write('Nhap so luong phan tu: ');

     readln(n);

     for i := 1 to n do

     begin

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

          readln(a[i]);

     end;

     s := 0;

     for i := 1 to n do

     begin

          if (a[i] mod 5 <> 0) then

               s := s + a[i];

     end;

     writeln('Tong cac so khong chia het cho 5: ', s);

     readln;

end.

Bình luận (0)
Nguyễn Hoàng Duy
2 tháng 4 2023 lúc 16:29

program TinhTong;
var
   n, i, s, x: integer;
begin
   write('Nhap so luong phan tu cua day: ');
   readln(n);

   s := 0;
   for i := 1 to n do
   begin
      write('Nhap phan tu thu ', i, ': ');
      readln(x);

      if (x mod 5 <> 0) then
         s := s + x;
   end;

   writeln('Tong cac so khong chia het cho 5 la: ', s);
end.

Bình luận (0)
Phạm Linh
Xem chi tiết
Minh Lệ
2 tháng 5 2023 lúc 21:28

Program HOC24;

var i,n: integer;

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

begin

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

for i:=1 to n do

begin

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

end;

for i:=1 to n do if a[i]>5 then write(a[i],' ');

readln

end.

Bình luận (0)
Aurora Maleine
Xem chi tiết
Nguyễn Lê Phước Thịnh
1 tháng 3 2022 lúc 22:57

uses crt;

var i,n,t:integer;

begin

clrscr;

readln(n);

t:=0;

for i:=1 to n do if i mod 2=1 then t:=t+i;

writeln(t);

readln;

end.

Bình luận (0)
Khánh Linh
Xem chi tiết
Nguyễn Lê Phước Thịnh
25 tháng 2 2022 lúc 8:21

#include <bits/stdc++.h>

using namespace std;

long long a[10000],i,n;

int main()

{

cin>>n;

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

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

cout<<endl;

t=0;

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

cout<<"Tong cac so chan la: "<<t<<endl;

sort(a+1,a+n+1);

cout<<"Day so giam dan la: ";

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

return 0;

}

Bình luận (1)
nam dzai
Xem chi tiết
datcoder
16 tháng 2 lúc 20:56

#include <bits/stdc++.h>

using namespace std;

int main(){

    int a,b,c,d,e;

    cin >> a >> b >> c >> d >> e;

    long t=0;

    if (a<0) t=t+a;

    if (b<0) t=t+b;

    if (c<0) t=t+c;

    if (d<0) t=t+d;

    if (e<0) t=t+e;

     cout << t;

     return 0;

}

Bình luận (0)
Huy Đại Ca
Xem chi tiết
Huy Đại Ca
5 tháng 5 2021 lúc 14:47

Viết chương trình nhập vào số nguyên n và tính tổng các số lẻ (các số lẻ là số không chia hết cho 2) trong khoảng từ 1 đến n ( ví dụ nhập = 10, ta sẽ có tổng sau s=1+3+5+7+9=25)

Bình luận (0)
Nguyễn Lê Phước Thịnh
5 tháng 5 2021 lúc 20:15

uses crt;

var i,n,s:integer;

begin

clrscr;

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

s:=0;

for i:=1 to n do 

 if i mod 2=1 then s:=s+i;

writeln(s);

readln;

end.

Bình luận (0)