test1
This commit is contained in:
+30
@@ -0,0 +1,30 @@
|
|||||||
|
### IntelliJ IDEA ###
|
||||||
|
out/
|
||||||
|
!**/src/main/**/out/
|
||||||
|
!**/src/test/**/out/
|
||||||
|
.kotlin
|
||||||
|
|
||||||
|
### Eclipse ###
|
||||||
|
.apt_generated
|
||||||
|
.classpath
|
||||||
|
.factorypath
|
||||||
|
.project
|
||||||
|
.settings
|
||||||
|
.springBeans
|
||||||
|
.sts4-cache
|
||||||
|
bin/
|
||||||
|
!**/src/main/**/bin/
|
||||||
|
!**/src/test/**/bin/
|
||||||
|
|
||||||
|
### NetBeans ###
|
||||||
|
/nbproject/private/
|
||||||
|
/nbbuild/
|
||||||
|
/dist/
|
||||||
|
/nbdist/
|
||||||
|
/.nb-gradle/
|
||||||
|
|
||||||
|
### VS Code ###
|
||||||
|
.vscode/
|
||||||
|
|
||||||
|
### Mac OS ###
|
||||||
|
.DS_Store
|
||||||
Generated
+10
@@ -0,0 +1,10 @@
|
|||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
# Ignored default folder with query files
|
||||||
|
/queries/
|
||||||
|
# Datasource local storage ignored files
|
||||||
|
/dataSources/
|
||||||
|
/dataSources.local.xml
|
||||||
|
# Editor-based HTTP Client requests
|
||||||
|
/httpRequests/
|
||||||
Generated
+6
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectRootManager" version="2" default="true" project-jdk-name="openjdk-25" project-jdk-type="JavaSDK">
|
||||||
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
Generated
+8
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectModuleManager">
|
||||||
|
<modules>
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/T1.iml" filepath="$PROJECT_DIR$/T1.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
Generated
+6
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="$PROJECT_DIR$/../.." vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="JAVA_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||||
|
<exclude-output />
|
||||||
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||||
|
</content>
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
</module>
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class EvenSum {
|
||||||
|
public static int sumEvenIndices(int[] numbers) {
|
||||||
|
ArrayList<Integer> myList = new ArrayList<>();
|
||||||
|
|
||||||
|
for (int x : numbers) {
|
||||||
|
myList.add(x);
|
||||||
|
}
|
||||||
|
int sum = 0;
|
||||||
|
for (int i = 0; i < myList.size(); i = i + 2) {
|
||||||
|
sum = sum + myList.get(i);
|
||||||
|
}
|
||||||
|
return sum;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
import java.util.Scanner;
|
||||||
|
|
||||||
|
public class Factorial {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
Scanner sc = new Scanner(System.in);
|
||||||
|
System.out.print("Enter number : ");
|
||||||
|
int n = sc.nextInt();
|
||||||
|
long result = 1;
|
||||||
|
for (int i = 1; i <= n; i++) {
|
||||||
|
result *= i;
|
||||||
|
}
|
||||||
|
System.out.println(result);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
public class FiboBin {
|
||||||
|
public static boolean isFiboBinary(int n) {
|
||||||
|
int a = 0;
|
||||||
|
int b = 1;
|
||||||
|
while (a <= n) {
|
||||||
|
int ones = Integer.bitCount(a);
|
||||||
|
if (a + ones == n) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
int next = a + b;
|
||||||
|
a = b;
|
||||||
|
b = next;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
public class HelloWorld {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
System.out.println("Hello, World!");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
import java.util.Scanner;
|
||||||
|
|
||||||
|
public class Palindrome {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
Scanner scanner = new Scanner(System.in);
|
||||||
|
System.out.print("Enter a string: ");
|
||||||
|
String text = scanner.next();
|
||||||
|
|
||||||
|
String reverse = "";
|
||||||
|
for (int i = text.length() - 1; i >= 0; i--) {
|
||||||
|
reverse = reverse + text.charAt(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (text.equals(reverse)) {
|
||||||
|
System.out.println("is Palindrome");
|
||||||
|
} else {
|
||||||
|
System.out.println("is not");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class PrimeFactors {
|
||||||
|
public static ArrayList<Integer> getPrimeFactors(int n) {
|
||||||
|
ArrayList<Integer> factors = new ArrayList<>();
|
||||||
|
|
||||||
|
for (int i = 2; i <= n; i++) {
|
||||||
|
while (n % i == 0) {
|
||||||
|
factors.add(i);
|
||||||
|
n = n / i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return factors;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user