Skip to content

Instantly share code, notes, and snippets.

@kryvoboker
Created May 20, 2020 18:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kryvoboker/828a7cc664e7ba56774dfc52e2db22bb to your computer and use it in GitHub Desktop.
Save kryvoboker/828a7cc664e7ba56774dfc52e2db22bb to your computer and use it in GitHub Desktop.
HomeWork7
public class Main {
public static void main(String[] args) {
int n = 2;
for (int i = 1; i <= 10; i++) {
System.out.println(getPI("PI", Math.PI, n));
n++;
}
}
public static String getPI(String name, double value, int n) {
String textNumber = String.format(name + " = %." + n + "f", value);
return textNumber;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment