Important Notice:
|| CCC Result Dec 2025 ||
|| CCC Marksheet Dec 2025 ||
|| O Level Jan 202& Reg. Form Last Date: 30/09/2026 ||
|| CCC Mar 2026 Exam Admit card Release ||
|| CCC/ O Level Exam Full Form ||
|| CCC Result Dec 2025 ||
|| CCC Marksheet Dec 2025 ||
|| O Level Jan 202& Reg. Form Last Date: 30/09/2026 ||
|| CCC Mar 2026 Exam Admit card Release ||
|| CCC/ O Level Exam Full Form ||
O Level
Notes
Follow us:
OLevelNotes
Home
O Level Notes
M1-R5.1
M2-R5.1
M3-R5.1
M4-R5.1
CCC
CCC Chapter Wise Notes
CCC Chapter Wise MCQ
CCC Modal Paper
CCC Previous Paper
CCC Assignment
CCC Online Test/Real Portal
Chapter Wise MCQ
M1-R5.1
M2-R5.1
M3-R5.1
M4-R5.1
Model Paper
M1-R5.1
M2-R5.1
M3-R5.1
M4-R5.1
O Level Real Test Portal
Old Paper
M1-R5.1
M2-R5.1
M3-R5.1
M4-R5.1
Practical
M1-R5.1
M2-R5.1
M3-R5.1
M4-R5.1
Prog. Lang.
JAVA
DBMS
SQL
Contact Us
ADCA
Introduction To Computer
Introduction To OS
MS Office
Tally Prime
Graphic Design
Web Design
Learn Typing
Typing Tutor
Typing Test
KCIT Student
Student Login
KCIT Student
Home
M3-R5.1
Operators, Expressions & Python Statements (Chapter: 4)
Sum of First N Natural Numbers
Sum of First N Natural Numbers
M3-R5.1
Operators, Expressions & Python Statements (Chapter: 4)
Sum of First N Natural Numbers
9 views
1 min read
Print
Share:
Program 7: Sum of First N Natural Numbers
n = int(input("Enter N: "))
sum = 0
for i in range(1, n + 1):
sum = sum + i
print("Sum =", sum)
Output:
Enter N: 5
Sum = 15
Calculation: 1 + 2 + 3 + 4 + 5 = 15
Previous
Operators, Expressions and Python Statem...
Next
Factorial of a Number
Table of Contents
Notes in Operators, Expressions & Python Statements (Chapter: 4)
Operators, Expressions and Python Statements (Table of Contents)
Introduction to Operators
Types of Operators in Python
Arithmetic Operators
Relational (Comparison) Operators
Logical Operators
Assignment Operators
Bitwise Operators
Membership Operators
Identity Operators
Expressions in Python
Operator Precedence and Associativity
Operator Precedence Table
practice quetion
Parentheses Expression
Assignment Statement
Simple Assignment
Multiple Assignment
Chained Assignment
Augmented Assignment Operators
Conditional Statements
The if Statement
The if...else Statement
The if...elif...else Statement
Nested if Statement
Simple Programs Based on Decision Making
Iterative Computation and Control Flow
Introduction to Loops
The range() Function
The for Loop
The while Statement
Nested Loops
Simple Programs Using Loops
Loop Control Statements
The break Statement
The continue Statement
The pass Statement
The else Clause with Loops
The assert Statement
Python Practice Programs with Output
Find Largest of Two Numbers
Find Largest of Three Numbers
Even or Odd Number
Positive, Negative or Zero
Multiplication Table
Sum of First N Natural Numbers
Factorial of a Number
Prime Number Check
Fibonacci Series
Reverse a Number
Count Digits of a Number
Print Odd and Even Numbers
Demonstration of break
Demonstration of continue
Demonstration of pass
Using else with for Loop
Using assert Statement
Other Topics
Introduction To Programming (Chapter: 1)
Algorithm & Flowchart (Chapter: 2)
Introduction To Python (Chapter: 3)
Sequence Data Types (Chapter: 5)
Functions In Python (Chapter: 6)
Practice MCQs
Test your M3-R5.1 knowledge with MCQs!
Start Quiz →
Related Notes
Operators, Expressions & Python Statements (Chapter: 4)
Operators, Expressions and Python Statements (Table of Conte...
2 min read
Operators, Expressions & Python Statements (Chapter: 4)
Introduction to Operators
1 min read
Operators, Expressions & Python Statements (Chapter: 4)
Types of Operators in Python
1 min read
Operators, Expressions & Python Statements (Chapter: 4)
Arithmetic Operators
3 min read
💻 Code Editor - Try It Yourself
📝 Your Code
Run Code ▶
📤 Output