Bạn chưa đăng nhập. Vui lòng đăng nhập để hỏi bài

Những câu hỏi liên quan
Hoài thịnh
Xem chi tiết
ko có tên
Xem chi tiết
nguyễn an phát
9 tháng 6 2021 lúc 14:21

uses crt;

var i,n:integer;

s:longint;

begin

  clrscr;

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

  s:=0;

  for i:=1 to n do

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

  else s:=s-i;

  writeln('s= ',s);

  readln;

end.

Bùi Duy Vương
Xem chi tiết
Đinh Thùy Linh
5 tháng 6 2016 lúc 12:13
Ta có : \(S=1+2+3+...+n=\frac{n\left(n+1\right)}{2}.\)Gọi số trừ là a, ta có \(S-a=410\)(\(1\le a\le n\))

\(S=410+a\)(1).

Vì \(1\le a\le n\)nên \(1+410\le a+410\le n+410\)

\(\Rightarrow411\le S\le410+n\Rightarrow411\le\frac{n\left(n+1\right)}{2}\le410+n\)

\(\Leftrightarrow822\le n\left(n+1\right)\le820+2n\)

\(\Leftrightarrow\hept{\begin{cases}n\left(n+1\right)\ge822\Rightarrow n\ge29\\n\left(n+1\right)\le820+2n\Rightarrow n^2-n\le820\Rightarrow n\left(n-1\right)\le820\Rightarrow n\le29\end{cases}}\)

\(\Rightarrow n=29\).

Và \(S=\frac{29\cdot30}{2}=435\).

Đáp số S=435 ; n= 29
TNhi
Xem chi tiết
Phạm thị thảo ly
Xem chi tiết
Đỗ Tuệ Lâm
20 tháng 3 2022 lúc 15:20

undefined

Minh Lệ
20 tháng 3 2022 lúc 18:49

Program HOC24;

var i,n: integer;

S,P: longint;

begin

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

{..............................................}

readln

end.

-----------------------------------------------------------

Bạn điền vào {........................} theo từng bài nhé

a) S:=0; 

for i:=1 to N do if i mod 2=1 then s:=s+i;

write('S= ',s);

b)

S:=0;

for i:=1 to N do if i mod 2=0 then s:=s+i;

write('S= ',s);

c) P:=1;

for i:=1 to N do if i mod 2=0 then p:=p*i;

write('P= ',p);

d)

P:=1;

for i:=1 to N do if i mod 2=1 then p:=p*i;

write('P= ',p);

Nguyễn Lê Phương Trà
Xem chi tiết
Rose Hạ Vy
30 tháng 7 2019 lúc 20:04

BTVN hay sao mà nhìu vậy bn

Dương Quỳnh Như
Xem chi tiết
Trường Nguyễn
Xem chi tiết
Minh Lệ
1 tháng 4 2022 lúc 11:26

Program HOC24;

var i,n: integer;

S: real;

begin

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

s:=0;

for i:=1 to N do s:=s+1/i;

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

readln

end.

thái jr
Xem chi tiết
Nguyễn Lê Phước Thịnh
16 tháng 1 2022 lúc 14:50

#include <bits/stdc++.h>

using namespace std;

long long s,i,n;

int main()

{

cin>>n;

s=0;

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

if (i%2==1) s=s+i*i;

cout<<s;

return 0;

}