Những câu hỏi liên quan
Nguyễn minh Hoàng
Xem chi tiết
Nguyễn Lê Phước Thịnh
14 tháng 3 2022 lúc 10:23

Đề khó hiểu quá bạn

Bình luận (0)
Phan Thị Ka
Xem chi tiết
Minh Lệ
19 tháng 3 2023 lúc 22:40

Câu 1:

Program HOC24;

var i,p: integer;

t: longint;

begin

write('Nhap P: '); readln(p);

t:=0;

for i:=1 to p do if i mod 2<>0 then t:=t+i;

write('Tong cac so le la: ',t);

readln

end.

Bình luận (0)
Minh Lệ
19 tháng 3 2023 lúc 22:41

Câu 2:

Program HOC24;

var i,n: integer;

t: longint;

begin

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

t:=0;

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

write('Tong cac so chan la: ',t);

readln

end.

Bình luận (0)
Minh Lệ
19 tháng 3 2023 lúc 22:42

Câu 3:

Program HOC24;

var i,t,n: integer;

begin

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

t:=0;

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

write('Tong cac uoc cua ',n,' la: ',t);

readln

end.

Bình luận (0)
việt hoàng
Xem chi tiết
Nguyễn Lê Phước Thịnh
24 tháng 1 2022 lúc 7:43

Bài 1: 

#include <bits/stdc++.h>

using namespace std;

long long a[10],n,i,t;

int main()

{

n=0;

do 

{

cin>>a[i];

}

while ((a[i]==0) or (n==10));

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=t+a[i];

cout<<t;

return 0;

}

Bình luận (1)
Tuấn Kiệt Phạm
Xem chi tiết
Như Ý
Xem chi tiết
Phía sau một cô gái
1 tháng 5 2023 lúc 19:27

Câu 1:

program Tinhtong:

var

     n, i, sum: integer;

begin

     write('Nhap n: ');

     readln(n);

     sum := 0;

     for i := 2 to n do

     begin

          if i mod 2 = 0 then

          begin

               sum := sum + i;

          end;

     end;

     writeln('Tong cac so chan tu 2 toi ', n, ' la ', sum);

     readln; 

end.

Câu 2:

program Tinhtong:

var

     n, i, sum: integer;

begin

     write('Nhap n: ');

     readln(n);

     sum := 0;

     for i := 1 to n do

     begin

          if i mod 2 = 1 then

          begin

               sum := sum + i;

          end;

     end;

     writeln('Tong cac so le tu 1 toi ', n, ' la ', sum);

     readln;

end.

Bình luận (1)
Nguyen Tu
Xem chi tiết
Cầu Nguyễn
Xem chi tiết
HT.Phong (9A5)
24 tháng 4 2023 lúc 13:43

Uses crt;

var i,n,k,u,f,y: longint;

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

begin clrscr;

readln(n);

for i:=1 to n do read(a[i]); readln;

writeln(a[i]);

for i:=1 to n do if(a[i]<0) then k:=k+a[i];

for i:=1 to n do if(a[i]>0) then u:=u+a[i];

for i:=1 to n do if(a[i] mod 2<>0) then f:=f+a[i];

for i:=1 to n do if(a[i] mod 2=0) then y:=y+a[i];

writeln('Tong cac so am la: ',k);

writeln('Tong cac so khong am: ',u);

writeln('Tong cac so le la: ',f);

writeln('Tong cac so chan la: ',y);

readln;

end.

Bình luận (0)
Lưu Thùy Linh
Xem chi tiết
Nguyễn Hoàng Duy
29 tháng 3 2023 lúc 15:28

program TinhTongSoTuNhienLe;
var
  N, i, sum: integer;
begin
  write('Nhap so N: ');
  readln(N);

  sum := 0;
  for i := 1 to N do
  begin
    if i mod 2 = 1 then // Kiểm tra số lẻ
      sum := sum + i;   // Cộng dồn vào tổng
  end;

  writeln('Tong cac so tu nhien le nho hon hoac bang N la: ', sum);
  readln;
end.

Bình luận (0)
Tú Thị Tuấn
Xem chi tiết
Nguyễn Lê Phước Thịnh
13 tháng 4 2022 lúc 18:18

#include <bits/stdc++.h>

using namespace std;

long long a[1000],i,n,t1,t2;

int main()

{

cin>>n;

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

t1=0;

t2=0;

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

{

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

else t2+=a[i];

}

cout<<t1<<endl;

cout<<t2;

return 0;

}

Bình luận (0)