Những câu hỏi liên quan
Nguyễn Hoàng Long
Xem chi tiết
Nguyễn Hoàng Long
24 tháng 3 2023 lúc 20:30

Pls giúp vs ạ !!!

Bình luận (0)
Phía sau một cô gái
24 tháng 3 2023 lúc 20:35

program TinhTong;

uses crt;

var

     n, i, tong: integer;

begin

     clrscr;

     write('Nhap vao so nguyen duong n: ');

     readln(n);

     tong := 0;

     for i := 1 to n-1 do begin

          if i mod 2 <> 0 then

               tong := tong + i;

     end;

     writeln('Tong cac so khong chia het cho 2 la: ', tong);

     readln;

end.

Bình luận (0)
emhocngulamgiupemvoi
Xem chi tiết
Lê Hải Dương
7 tháng 3 2023 lúc 20:52

uses crt;

var i,n,d:longint;

begin 

d:=0;

writeln('nhapn=');read(n);

for i:=1 to n do

begin

if i mod 3=0 then write(i,' ');

if i mod 3=0 then d:=d+i;

end;

writeln('tong=',d);

readln;

end;

Bình luận (0)
Lê Hải Dương
7 tháng 3 2023 lúc 20:53

 

 

 

Bình luận (0)
Hoangf Thu
Xem chi tiết
ngomanhcuong
Xem chi tiết
Nguyễn Lê Phước Thịnh
15 tháng 3 2022 lúc 20:25

#include <bits/stdc++.h>

using namespace std;

long long x,n,i,t,dem;

int main()

{

cin>>n;

dem=0;

t=0;

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

{

cin>>x;

if (x%2==0 && x>10) t+=x;

if (x%2!=0 || x<100) dem++;

}

cout<<t<<" "<<dem;

return 0;

}

Bình luận (0)
thanhlee 011
Xem chi tiết
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)
Anh Kieu
Xem chi tiết
Nguyễn Lê Phước Thịnh
22 tháng 12 2022 lúc 10:09

uses crt;

var i,t:integer;

begin

clrscr;

t:=0;

for i:=1 to 100 do

if i mod 5<>0 then t:=t+i;

writeln(t);

readln;

end.

Bình luận (0)
Đạt Trần
Xem chi tiết
Nguyễn Lê Phước Thịnh
18 tháng 5 2021 lúc 9:49

uses crt;

var a:array[1..100]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;

for i:=1 to n do 

  write(a[i]:4);

writeln;

t:=0;

for i:=1 to n do 

  if a[i] mod 7=0 then t:=t+a[i];

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

readln;

end. 

Bình luận (0)
Mĩ Lâm
Xem chi tiết
Nguyên Hưng Trần
22 tháng 7 2021 lúc 21:25

Uses crt;
var f1,f2:text;
    i,n,tong,tongchan,dem:integer;
    tb:real;
Begin
 clrscr;
 Assign(f1,'DAYSO.txt');
 Assign(f2,'KETQUA.txt');
 reset(f1);dem:=0;tong:=0;tongchan:=0;
 While Not EOF(f1) do
  Begin
  read(f1,i);
  inc(tong,i);
  If i mod 2 = 0 then
    begin
    inc(dem);
    inc(tongchan,i);
    end;
  End;
 tb:=tongchan/dem;
 close(f1);
 rewrite(f2);
 writeln(f2,tong);
 writeln(f2,tongchan);
 writeln(f2,tb:0:2);
 close(f2);
 write(tong);
 readln;
End.

Bình luận (0)