Những câu hỏi liên quan
Gia Hân
Xem chi tiết
Minh Lệ
1 tháng 3 2021 lúc 21:03

Program HOC24;

var n,i: integer;

s: longint;

begin

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

s:=2021;

for i:=0 to n do s=s+(2*i+1);

write('S= ',s);

readln

end.

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

*Cách 2: Dùng While do

uses crt;

var s,i,n:integer;

begin

clrscr;

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

s:=2021;

i:=0;

while i<=n do 

  begin

s:=s+(2*i+1);

i:=i+1;

end;

writeln(s);

readln;

end.

Bình luận (0)
Lâm Khả Doanh
Xem chi tiết
Nguyễn Lê Phước Thịnh
28 tháng 2 2023 lúc 22:28

1:

uses crt;

var n,i,t:integer;

begin

clrscr;

readln(n);

t:=0;

for i:=1 to n do

t:=t+i*i;

write(t);

readln;

end.

Bình luận (0)
Lê Chiêu Nguyên	Vũ
4 tháng 4 2023 lúc 10:21

2

program bt2;

var i,n,t:integer;

begin

readln(n);

s:=0;

for i:=1 to n do

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

readln;

end.

Bình luận (0)
Phương Linh Pham Thị
Xem chi tiết
HT.Phong (9A5)
24 tháng 3 2023 lúc 12:06

int main() 

{

int n;

long s;

s=0;

i=1;

printf("\nSo n la: ");

scanf("%d",&n);

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

    {

    s=s+i;

    }

printf("\nTổng %d là %ld: ", n, s);

}

Bình luận (1)
☆⩸Moon Light⩸2k11☆
Xem chi tiết
Pommbiijj
25 tháng 5 2022 lúc 19:58

Sao bài bạn giống hệt bài lớp mình nhỉ

Bình luận (0)
phạm hương trà
Xem chi tiết
Công Chúa Sakura
4 tháng 1 2017 lúc 22:32

a)

uses crt;

VAR

n, d, i: integer;

BEGIN

clrscr;

Writeln ('Nhap vao n='); readln (n);

d : = 1;

For i: = 1 to n do

d: = d*i;

Writeln ('d=',d);

Readln;

END.

c)

uses crt;

VAR

n, i, demuoc: integer;

BEGIN

clrscr;

Writeln ('Nhap vao n='); readln (n);

demuoc: = 0;

For i: = 1 to n do

If n mod i = 0 then

demuoc : = demuoc + 1;

If demuoc = 2 then

Writeln ('n la so nguyen to')

ELSE

Writeln ('n khong phai la so nguyen to');

Readln ;

END.

Còn phần b bạn tự nghĩ nha!

Chúc bạn học tốt!

Bình luận (0)
Pham Huynh Bao Thy
Xem chi tiết
nuinuini
Xem chi tiết
Thị Thảo Ly Hoàng
Xem chi tiết
Minh Lệ
13 tháng 3 2023 lúc 12:21

Program HOC24;

var i,n: integer;

s: longint;

begin

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

s:=0;

for i:=1 to n do s:=s+sqr(i);

write('S= ' ,s);

readln

end.

Bình luận (0)
HT.Phong (9A5)
13 tháng 3 2023 lúc 12:27

Uses crt;

var i,n,y: integer;

begin clrscr;

readln(n);

for i:=1 to n do s:=i*i;

Writeln(s);

readln;

end.

Bình luận (1)
Lê Thị Thùy Dung
Xem chi tiết
Nguyễn Lê Phước Thịnh
18 tháng 2 2022 lúc 0:09

Bài 1: 

#include <bits/stdc++.h>

using namespace std;

long long i,n,x,t;

int main()

{

cin>>n;

t=0;

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

{

cin>>x;

if (x%15==0) t=t+x;

}

cout<<t;

return 0;

}

Bình luận (0)