We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent cc6a7d1 commit 9e2943dCopy full SHA for 9e2943d
SumOfNaturalNumber.java
@@ -0,0 +1,16 @@
1
+import java.util.Scanner;
2
+class SumOfNaturalNumber
3
+ {
4
+ public static void main(String[] args)
5
6
+ int i, num , sum = 0;
7
+ Scanner s=new Scanner(System.in);
8
+ System.out.print("ENTER THE NO OF DIGIT:");
9
+ num=s.nextInt();
10
+ for(i = 1; i <= num; ++i)
11
12
+ sum = sum + i;
13
+ }
14
+ System.out.println("Sum of First 10 Natural Numbers is = " + sum);
15
16
0 commit comments