Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
square of array element
//'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); } } } }
run
|
edit
|
history
|
help
0
Magic No.
reverse integer
PE #5
first activity
java
Abhay
rd dap da
ab
Palindrome String Checking
Brainf*ck Interpreter (Java)