Starting git repo for working on files

This commit is contained in:
sulzlep
2024-07-13 12:44:25 +02:00
commit d45a2994e8
20 changed files with 185 additions and 0 deletions
+23
View File
@@ -0,0 +1,23 @@
public class GeneralizedHarmonic
{
public static void main(String[] args)
{
int n = Integer.parseInt(args[0]);
int r = Integer.parseInt(args[1]);
if (r >= 0 && n >= 0)
{
double h = 0;
double breuk = 0;
for (int i = 1; i <= n; i++ )
{
breuk = 1/(Math.pow(i,r));
h += breuk;
}
System.out.println(h);
}
else
{
System.out.println("Negative number in one of the arguments");
}
}
}