Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
3.B
//'main' method must be in a class 'Rextester'. //openjdk version '11.0.5' // Razak-7051 import java.util.*; import java.lang.*; class Rextester { public static void main(String args[]) { int n; int sum; Scanner in = new Scanner(System.in); System.out.println("Enter the number:\n"); n=in.nextInt(); sum=0; for(int i=1;i<=n;i++) { sum+=i; } System.out.println("The sum of numbers up to "+n+" is :"+sum); } }
run
|
edit
|
history
|
help
0
decToBin
Hi Hypotaneous
Le saviez-vous ?
javaClassAr
Product of Array Except Self
Find Median in Large File of Integers
1.6
classwork
클래스의 정의와 인스턴스 생성
Hi