Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
ChangePI
Language:
Ada
Assembly
Bash
C#
C++ (gcc)
C++ (clang)
C++ (vc++)
C (gcc)
C (clang)
C (vc)
Client Side
Clojure
Common Lisp
D
Elixir
Erlang
F#
Fortran
Go
Haskell
Java
Javascript
Kotlin
Lua
MySql
Node.js
Ocaml
Octave
Objective-C
Oracle
Pascal
Perl
Php
PostgreSQL
Prolog
Python
Python 3
R
Rust
Ruby
Scala
Scheme
Sql Server
Swift
Tcl
Visual Basic
Layout:
Vertical
Horizontal
//'main' method must be in a class 'Rextester'. //Compiler version 1.8.0_111 import java.util.Scanner; class Rextester { private static String changePI (String str) { if (str.length () <= 2) return str.equals ("pi") ? "3.14" : str; return str.substring (0, 2).equals ("pi") ? "3.14".concat ( changePI (str.substring (2)) ) : str.substring (0, 1).concat ( changePI (str.substring (1)) ); } public static void main(String args[]) { Scanner scan = new Scanner (System.in); String [] arr = new String [5]; int i = 0; try { while ( (arr[i] = scan.nextLine ()) != "" ) System.out.println (changePI (arr [i++])); } catch (Exception e) { System.out.println ("no more found!"); } } }
xpix pipi
[
-
]
Show input
Compilation time: 0.83 sec, absolute running time: 0.18 sec, cpu time: 0.14 sec, memory peak: 20 Mb, absolute service time: 1,01 sec
edit mode
|
history
|
discussion
x3.14x 3.143.14 no more found!