Untitled

 avatar
unknown
plain_text
4 years ago
349 B
86
Indexable

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in); 
		
		int n = sc.nextInt(); 
		int sum = 0; 
		int res = 0; 
		for(int i = 1; i <= n; i++) { 
			sum += i; 
			if(sum > n) { 
				res = i - 1;  
				break;
			}
		} 
		System.out.println(res);
	}
}
Editor is loading...