Tính tổng S = 1 + 2 + 3 + … + ~n~

View as PDF

Submit solution

Points: 100.00
Time limit: 0.2s
Memory limit: 100M
Input: stdin
Output: stdout

Author:
Problem type
Allowed languages
C, C++, GAS64, Pascal, Perl, PHP, Python, Sed, TCL, Text

Tính ~S(n)~ = 1 + 2 + 3 + ... + ~n~. Với ~n~ cho trước.

  • Đầu vào là 1 số 𝑛
  • Đầu ra là kết quả 𝑆

Input

5

Output

15

Comments

Please read the guidelines before commenting.



  • 0
    GiaLinhSiK24  commented on Dec. 21, 2022, 1:28 a.m.

    n=int(input('n=')) S=0 for i in range(1,n+1): S=S+i print(S)


  • 0
    Ngân_10Si  commented on Dec. 21, 2022, 1:24 a.m.

    n=int(input( 'n=')) sum=0 For i in range(1,n): S=S+i Print (S)


  • 0
    2_iCloud  commented on Dec. 21, 2022, 1:16 a.m.

    n=int(input()) s=0 for i in range(1,n+1): s=s+i print(s)


  • 0
    TrangSik24  commented on Dec. 21, 2022, 1:14 a.m.

    n=int(input()) s=0 for i in range (1,n+1): s=s+i print(' tổng các số n',s)


  • 0
    nnhi_winhh  commented on Nov. 10, 2022, 1:21 a.m.

    n=int(input()) s=int(n*(n+1)/2) print(s)


  • 0
    anhtuan2007  commented on Sept. 19, 2022, 8:13 a.m.

    manh