Tính tổng S=1*4+2*5+3*6+4*7+....+n*(n+3)
Hãy nhập câu hỏi của bạn vào đây, nếu là tài khoản VIP, bạn sẽ được ưu tiên trả lời.
![](https://rs.olm.vn/images/avt/0.png?1311)
![](https://rs.olm.vn/images/avt/0.png?1311)
![](https://rs.olm.vn/images/avt/0.png?1311)
![](https://rs.olm.vn/images/avt/0.png?1311)
uses crt;
var s:real;
i,n:integer;
begin
clrscr;
readln(n);
s:=0;
for i:=1 to n do
s:=s+(n*(n+1))/((n+2)*(n+3));
writeln(s:4:2);
readln;
end.
![](https://rs.olm.vn/images/avt/0.png?1311)
![](https://rs.olm.vn/images/avt/0.png?1311)
Câu 2:
#include <bits/stdc++.h>
using namespace std;
double p1,p2;
int i,n;
int main()
{
cin>>n;
p1=1;
p2=1;
for (i=1; i<=n; i++)
{
if (i%2==0) p2=p2*(i*1.0);
else p1=p1*(i*1.0);
}
cout<<fixed<<setprecision(2)<<p1<<endl;
cout<<fixed<<setprecision(2)<<p2;
return 0;
}
![](https://rs.olm.vn/images/avt/0.png?1311)
Câu a:
n = int(input("Nhập số nguyên n: "))
S = 0
for i in range(1, n+1):
S += i
print("Tổng S =", S)
Câu b:
n = int(input("Nhập số nguyên n: "))
S = 0
for i in range(1, n, 2):
S += i
print("Tổng S =", S)
Câu c:
def calc_sum(n):
s=0
for i in range(1,n+1):
s += 2*i
return s
n = int(input("Nhập vào số n: "))
print("Tổng S=2+4+6+...2n là:",calc_sum(n))
n = int(input("Nhập số nguyên n: "))
S = 0
for i in range(1, n+1):
S += i
print("Tổng S =", S)
Câu b:
n = int(input("Nhập số nguyên n: "))
S = 0
for i in range(1, n, 2):
S += i
print("Tổng S =", S)
Câu c:
def calc_sum(n):
s=0
for i in range(1,n+1):
s += 2*i
return s
n = int(input("Nhập vào số n: "))
print("Tổng S=2+4+6+...2n là:",calc_sum(n))
![](https://rs.olm.vn/images/avt/0.png?1311)
1+(2+2)