Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Created some programs and arranged all java programs in a directory #120

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
150326b
Create factor.java
rohit2k3 Oct 13, 2021
e27c1ed
Create factorial.java
rohit2k3 Oct 13, 2021
fa72c0c
Create averagesum.java
rohit2k3 Oct 13, 2021
ecf12d5
Rename Java/averagesum.java to Programs/Java/averagesum.java
rohit2k3 Oct 13, 2021
93ac3ac
Rename Java/factor.java to Programs/Java/factor.java
rohit2k3 Oct 13, 2021
b606f0b
Rename Java/factorial.java to Programs/Java/factorial.java
rohit2k3 Oct 13, 2021
08ad34f
Rename Programs/AllTraversal.java to Programs/Java/AllTraversal.java
rohit2k3 Oct 13, 2021
926268b
Rename Programs/BalanceBrackets.java to Programs/Java/BalanceBrackets…
rohit2k3 Oct 13, 2021
0ff632e
Rename Programs/Breadthfirstsearch.java to Programs/Java/Breadthfirst…
rohit2k3 Oct 13, 2021
81b4aff
Rename Programs/DFS.java to Programs/Java/DFS.java
rohit2k3 Oct 13, 2021
3ded0c8
Rename Programs/DetectLoop.java to Programs/Java/DetectLoop.java
rohit2k3 Oct 13, 2021
bfb1b8d
Rename Programs/Recursive_binarysearch.java to Programs/Java/Recursiv…
rohit2k3 Oct 13, 2021
eb68217
Rename Programs/ReverseLinkedList.java to Programs/Java/ReverseLinked…
rohit2k3 Oct 13, 2021
927aa8f
Rename Programs/number_diamond.java to Programs/Java/number_diamond.java
rohit2k3 Oct 13, 2021
5b02824
Rename Programs/Longest substring without repeating character.java to…
rohit2k3 Oct 13, 2021
d650a43
Rename Programs/String to LowerCase.java to Programs/Java/String to L…
rohit2k3 Oct 13, 2021
24d4d6c
Rename Programs/frequency_sort.java to Programs/Java/frequency_sort.java
rohit2k3 Oct 13, 2021
94d2abe
Rename Programs/jatin_game.java to Programs/Java/jatin_game.java
rohit2k3 Oct 13, 2021
727888c
Rename Programs/stringReverse.java to Programs/Java/stringReverse.java
rohit2k3 Oct 13, 2021
fa98633
Rename Programs/zigzagPattern.java to Programs/Java/zigzagPattern.java
rohit2k3 Oct 13, 2021
6fd3df1
Update and rename averagesum.java to AverageSum.java
rohit2k3 Oct 13, 2021
76583ec
Update and rename factor.java to Factor.java
rohit2k3 Oct 13, 2021
153b56f
Update and rename factorial.java to Factorial.java
rohit2k3 Oct 13, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
24 changes: 24 additions & 0 deletions Programs/Java/AverageSum.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import java.util.Scanner;

public class AverageSum {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("Enter n numbers to get Average ");
int n = input.nextInt();
int count = 0;
int sum = 0;
int rem = 1;
if (n==0) {
System.out.println("Please Enter value greater than 0");
System.exit(0);

}
while(n>0){
rem = n%10;
sum = sum+rem;
count+=1;
n=n/10;
}
System.out.println("Average is "+sum/count);
}
}
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion Programs/DFS.java → Programs/Java/DFS.java
Original file line number Diff line number Diff line change
Expand Up @@ -229,4 +229,4 @@ public static void main(String[] args)
//passing the starting vertex to the function
g.DFS(2);
}
}
}
File renamed without changes.
17 changes: 17 additions & 0 deletions Programs/Java/Factor.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import java.util.Scanner;

public class Factor{
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.println("------------------Program to print factor of n numbers------------------");
System.out.print("Enter N number ");
int n = input.nextInt();
System.out.print("Factor of "+n+" is: ");
for (int i = 1;i<=n;i+=1 ) {
if (n%i==0) {
System.out.print(" "+i+" ");
}

}
}
}
15 changes: 15 additions & 0 deletions Programs/Java/Factorial.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import java.util.Scanner;

public class Factorial {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("Enter a number to get factorial of it ");
int n = input.nextInt();
int m = 1;
while(n>0){
m = m*n;
n-=1;
}
System.out.println("Fortorial is "+m);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ public static void main(String[] args)
int result = lengthOfLongestSubstring(s);
System.out.println(res);
}
}
}
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ static String toLower(String S) {
return S1;
}

}
}
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ public static void main(String[] args) {
}

}
}
}
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@ public static void zigzag(int [][] a, int r, int c){
}

}
}
}