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

Copy
5

Output

Copy
15

Comments

Please read the guidelines before commenting.



  • -1
    GiaLinhSiK24  commented 1:28:44 am, 21/12/2022

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


  • -1
    Ngân_10Si  commented 1:24:53 am, 21/12/2022

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


  • -1
    2_iCloud  commented 1:16:18 am, 21/12/2022

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


  • -1
    TrangSik24  commented 1:14:28 am, 21/12/2022

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


  • -1
    nnhi_winhh  commented 1:21:55 am, 10/11/2022

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


  • -1
    anhtuan2007  commented 8:13:46 am, 19/09/2022

    manh