Natural numbers are the counting numbers. On this page we use the school-friendly rule: an integer is natural when n > 0 (that is, 1, 2, 3, …).
Remember
n is natural ⇔ n is an integer and n > 0
Examples:
1 → natural
42 → natural
0 → not natural (this page)
-3 → not natural
Note: some syllabi include 0. Always state your definition.
n
Check
Result
5
5 > 0
Natural
1
1 > 0
Natural
0
0 > 0 is false
Not natural
-2
-2 > 0 is false
Not natural
Approach
How to Check a Natural Number in C#
Three clear steps — then either classify one value or list a range.
State the definition you will use (here: n > 0).
Compare the integer against zero and return a boolean.
Optionally loop from 1 to N to print natural numbers in a range.
Task
Idea
Time
Best for
Single check
return n > 0;
O(1)
Yes/no classification
Range print
Loop i from 1 to N
O(N)
Listing counting numbers
Pseudocode
Pseudocode
function IsNatural(n):
return n > 0
function PrintNaturals(limit):
for i from 1 to limit:
print i
Reference
Cheat Sheet
Keep these facts handy while writing the program.
Topic
Detail
This page rule
n > 0
Alternate rule
n >= 0 (includes zero)
Set
{1, 2, 3, …}
Zero
Not natural here — say so in interviews
Negatives
Never natural under either common rule
Helper tip
Return bool; let Main print the message
Try it
Live Preview
Enter any integer to see whether it is natural under n > 0.
Whole numbers only. Tap a chip or type a value.
Result
n = 5
Check: 5 > 0 → true
Verdict: NATURAL NUMBER
Trace
Worked Walkthrough — n = 5 and n = 0
Apply the same comparison to a yes case and a boundary case.
Calculation
Case A: n = 5
5 > 0 ? yes → natural
Case B: n = 0
0 > 0 ? no → not natural (on this page)
Case C: n = -3
-3 > 0 ? no → not natural
Code
C# Programs
Start with a boolean helper for one value. Then print natural numbers from 1 to 10 with a simple loop.
Example 1 — Single Check
Return true when the integer is greater than zero.
C#
using System;
class Program
{
static bool IsNatural(int n)
{
return n > 0;
}
static void Main()
{
int number = 5;
if (IsNatural(number))
{
Console.WriteLine(number + " is a Natural Number.");
}
else
{
Console.WriteLine(number + " is not a Natural Number.");
}
}
}
Output
5 is a Natural Number.
How It Works
IsNatural encodes the page rule in one comparison: n > 0.
No loop is needed — the answer is a single boolean.
Main calls the helper and prints a clear message.
For 5, the check is true, so the program reports a natural number.
Swap in 0 or a negative to see the not-natural branch.
Example 2 — Print Natural Numbers 1 to 10
Natural numbers start at 1, so a forward loop from 1 through 10 lists them.
C#
using System;
class Program
{
static void Main()
{
Console.WriteLine("Natural numbers from 1 to 10:");
for (int i = 1; i <= 10; i++)
{
Console.Write(i + " ");
}
}
}
Output
Natural numbers from 1 to 10:
1 2 3 4 5 6 7 8 9 10
How It Works
Start at i = 1 because this page excludes zero.
The loop condition i <= 10 keeps the end inclusive.
Each pass prints the current natural number and a space.
After i becomes 11, the loop stops.
Change 10 to any positive limit to print a longer range.
Edge Cases & Pitfalls
Check these before calling the solution done.
Zero
Definition debate
Under n > 0, zero is not natural. Say your rule out loud in interviews.
Negatives
Always false
Negative integers are never natural under the common school definitions.
Decimals
Integers only
This page classifies int values. Floating-point input needs a different conversation.
Range start
Begin at 1
If you start a print loop at 0, you are listing whole numbers, not this page’s naturals.
Analysis
Time and Space Complexity
Program
Time
Extra space
Single check
O(1)
O(1)
Print 1 to N
O(N)
O(1)
Remember
Key Takeaways
Definition: natural means n > 0 on this page.
Check: one comparison is enough — no loops required.
List: print from 1 to N with a forward for loop.
Test set: 1 and 5 natural; 0 and −3 not natural.
One line: if n > 0, it is a natural number under this tutorial’s rule.
Frequently Asked Questions
On this page, a natural number is a positive integer: 1, 2, 3, and so on. The check is simply n > 0.
It depends on the textbook. Some include 0. This tutorial uses n > 0, so 0 is not natural here.
No. Negative integers fail n > 0.
No. Natural numbers are whole counting numbers. Values like 1.5 are out of scope.
Change the rule to n >= 0 and say so in your explanation. Keep the code and wording aligned.
A single check is O(1). Printing natural numbers from 1 to N is O(N).