Pinnacle Inc. is a leading security firm that takes tare of managing the customer details of various banks located in Berlin. There was some intervention in the server that is used for storing the
data and the data have been manipulated by the attackers.
The employees of Pinnacle are now in a position to get all the data right with respect to the customer ID.
The customer ID of the employeeswill always be a 6 digit number and the current task is to develop an application that displays all the ID's that does not fall in the valid category from the existing
set of ID's.
Input
First line consists of an integer 'n' representing the number of ID's to be verified and the second line with n strings seperated by a single space
Output
Display the entire ID's that does not satisfy the criteria and if all the ID's are valid, display 0.
Example 1:
Input
5
103010 12036 20626 2 661281
Output
12036 20626 2
Example 2:
Input
6
Answers
Answered by
8
Answer:
var n = prompt("enter n");
var numbers = prompt("enter numbers");
var num=numbers.toString().split(' ');
var output ='';
var count =0;
for (i=0 ; i<n;i++)
{
var numdigits=0;
var p=num[i];
while(p>0)
{
p=parseInt(p/10);
numdigits++;
}
if (numdigits==6)
{
count++;
}
else
{
output= output + " " +num[i];
}
}
if (count==n)
{
console.log("0");
}
else
{
console.log(output);
}
Similar questions