Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
square of array element
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 /* Given a list of integers, return a list of those numbers squared and the product added to 10, omitting any of the resulting numbers that end in 5 or 6. square56([3, 1, 4]) → [19, 11] square56([1]) → [11] square56([2]) → [14] */ import java.util.*; import java.lang.*; class Rextester { public static void main(String args[]) { int x=0; Scanner sc = new Scanner(System.in); System.out.println("enter string"); String s= sc.nextLine(); String[] arr = s.split(" "); for(int i=0;i<arr.length;i++) { int z= Integer.parseInt(arr[i]); int q=z*z; if( q%10 !=5 && q%10 != 6) { System.out.println(q+10); } } } }
3 4 5
[
-
]
Show input
Compilation time: 0.63 sec, absolute running time: 0.16 sec, cpu time: 0.15 sec, memory peak: 20 Mb, absolute service time: 0,8 sec
edit mode
|
history
|
discussion
enter string 19