-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSumNatural.java
More file actions
23 lines (20 loc) · 501 Bytes
/
SumNatural.java
File metadata and controls
23 lines (20 loc) · 501 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package javaprograming;
/**
*
* @author rohan
*/
public class SumNatural {
public static void main(String[] args) {
int num = 100;
int sum=0;
for(int i=1;i<=num;i++){
sum+=i;
}
System.out.println("sum of natural number is: "+sum);
}
}