Skip to content
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
Arpit27kr
/
java
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Files
Expand file tree
main
Breadcrumbs
java
/
recursion.java
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
17 lines (15 loc) · 287 Bytes
main
Breadcrumbs
java
/
recursion.java
Copy path
Top
File metadata and controls
Code
Blame
17 lines (15 loc) · 287 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
public class recursion {
public static void main(String[] args)
{
int result=sum(9);
System.out.println("sum of 10 numbers from back is " +result);
}
public static int sum(int k) {
if(k>5 && k<10) {
return k+sum(k-1);
}
else {
return 0;
}
}
}
You can’t perform that action at this time.