Những câu hỏi liên quan
Lê Nguyễn Thanh Quân
Xem chi tiết
M1014-AWM
27 tháng 3 2021 lúc 17:16


program tinhtong;

uses crt;

var i, n, s: integer;

begin clrscr;

Write('N so tu nhien dau tien la: ');

readln(n);

s:=0;

i:=1;

while i<=n do begin

s:=s+i;

i:=i+1;

end;

writeln('Tong cac so la: ',s);

readln

end.

 

Bình luận (1)
nguyễn an phát
27 tháng 3 2021 lúc 20:35

program tinhtong;

uses crt;

var i,n,t:longint;

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

begin

clrscr;

write('nhap so n:');readln(n);

for i:=1 to n do 

begin

write('nhap phan tu a[',i,']:');readln(a[i]);

end;

t:=0;i:=1;

repeat

t:=t+i;

i:=i+1;

until i=n;

writeln('tong cua ca so tren la:',t);

writeln('trung binh cua cac so tren la:',t/n);

readln;

end.

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

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;

t:=0;

for i:=1 to n do 

  t:=t+a[i];

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

writeln('Trung binh cong cac so la: ',t/n:4:2);

readln;

end.

Bình luận (0)
Khánh Hoàng
Xem chi tiết
Minh Lệ
7 tháng 3 2023 lúc 21:32

Program HOC24;

var i,n: integer;

s: real;

begin

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

i:=1;

while i<=n do

begin

s:=s+1/sqr(i);

i:=i+1;

end;

write('S= ',s:8:2);

readln

end.

Bình luận (0)
Minh Ngọc
Xem chi tiết
Nguyễn Lê Phước Thịnh
20 tháng 1 2022 lúc 15:09

uses crt;

var a,t,i:integer;

begin

clrscr;

t:=0;

for i:=1 to 6 do 

  begin

readln(a);

if (a mod 2=0) then t:=t+a;

end;

writeln(t);

readln;

end.

Bình luận (1)
Thư Uyên
Xem chi tiết
Nguyễn Lê Phước Thịnh
26 tháng 3 2021 lúc 20:05

Bài 1: 

uses crt;

var n,i,s:integer;

begin

clrscr;

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

s:=0;

i:=1;

while i<=n do 

  begin

s:=s+i;

inc(i);

end;

writeln('Tong cac so trong khoang tu 1 den ',n,' la: ',s);

readln;

end.

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

Bài 2: 

uses crt;

var n,i,s:integer;

begin

clrscr;

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

s:=0;

i:=1;

while i<=n do 

  begin

s:=s+i;

i:=i+2;

end;

writeln('Tong cac so le trong khoang tu 1 den ',n,' la: ',s);

readln;

end.

Bình luận (0)
NgocTuan
3 tháng 1 2022 lúc 20:13

alo

Bình luận (0)
Võ Tấn Trường Phạm
Xem chi tiết
Nguyễn Lê Phước Thịnh
9 tháng 3 2023 lúc 15:01

#include <bits/stdc++.h>

using namespace std;

int main()

{

int n,t=0;

cin>>n;

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

if (i%6==0) t+=i;

cout<<t;

return 0;

}

Bình luận (0)
NGUYỄN LÊ XUÂN THỊNH
Xem chi tiết
Kiều Vũ Linh
23 tháng 2 2023 lúc 11:23

Bài 1

Var s,i:integer;

tb:real;

Begin

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

i:=1;

s:=0;

While i<=n do

Begin

s:=s+i;

i:=i+1;

End;

tb:=s/n;

Writeln('Tong la ',s);

Write('Trung binh la ',tb:10:2);

Readln;

End.

Bình luận (1)
Kiều Vũ Linh
23 tháng 2 2023 lúc 11:27

Bài 2

Var i,n,souoc:integer;

Begin

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

i:=1;

While i <= n do

Begin

i:=i + 1;

If n mod i = 0 then souoc:=souoc + 1;

End;

If souoc = 1 then write(n,' la so nguyen to')

Else write(n,' khong la so nguyen to');

Readln;

End.

Bình luận (1)
Trần Thị Mai Ngọc
Xem chi tiết
nguyễn an phát
18 tháng 4 2021 lúc 20:48

program tim_uoc;

uses crt;

var i,n,tong:integer;

begin

clrscr;

write('nhap so n:');readln(n);

i:=1;tong:=0;

writeln('cac uoc cua ',n,' la:');

while i<=n do

if n mod i=0 then

begin

write(i:3);

inc(i);

end;

writeln;

i:=1;writeln('cac uoc chan:');

while i<=n do

begin

if n mod i=0 then 

begin

if i mod 2=0 then write(i:3);

tong:=tong+i;

end;

end;

writeln;

write('tong cac uoc chan:',tong);

readln;

end.

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

uses crt;

var n,i,t:integer;

begin

clrscr;

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

i:=1;

writeln('Cac uoc cua ',n,' la: ');

while i<=n do

  begin

if n mod i=0 then write(i:4):

i:=i+1;

end;

writeln;

writeln('Cac uoc chan cua ',n,' la: ');

t:=0;

i:=1;

while i<=n do 

  begin

if (n mod i=0) then

begin

t:=t+i;

write(i:4);

end;

inc(i);

end;

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

readln;

end.

Bình luận (0)
Khánh Hoàng
Xem chi tiết
Minh Lệ
7 tháng 3 2023 lúc 22:51

Program HOC24;

var i,n: integer;

S: longint;

begin

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

i:=2; s:=0;

while i<=n do

begin

s:=s+i;

i:=i+2;

end;

write('S=',S);

readln

end.

Bình luận (0)
Nguyễn Hoàng Duy
19 tháng 3 2023 lúc 22:42

program TongCacSoChan;
var
    n, s, i: integer;
begin
    write('Nhap n: ');
    readln(n);
    s := 0;
    i := 2;
    while i <= n do
    begin
        s := s + i;
        i := i + 2;
    end;
    writeln('Tong cac so chan la: ', s);
    readln;
end.

 

Bình luận (0)
Snsbbdbd Xnxb
Xem chi tiết
Kiều Vũ Linh
13 tháng 5 2023 lúc 8:57

Var i,n:integer;

Begin

Write('n = ');readln(n);

Write('Day so tu 1 den ',n,' la ');

For i:=1 to n do write(i:8);

Readln

End.

Bình luận (0)