Dsa
Math
Easy
Triangular Number Check
A triangular number is a number that can form an equilateral triangle. The nth triangular number is the sum of the first n natural numbers: T_n = n * (n + 1) / 2. Your task is to write a program that checks if a given positive integer M is a triangular number. If it is, output 'Yes'. If not, output 'No'.
Input Format:
- A single integer M (1 <= M <= 10^9)
Output Format:
- 'Yes' or 'No'
Example:
Input:
6
Output:
Yes
Key concepts
mathnumber theory
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now