Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
3b
//'main' method must be in a class 'Rextester'. //openjdk version '11.0.5' //Lokesh reddy 7002 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
Prime or Not
jb12.0 threads.enums
MAP List Iterator
else if statement
Only I love u
smallest number and its index(position)
th
detect cycle in singly linked list
1a
Edna Garcia