answersLogoWhite

0


Best Answer

class position//Finds the position of the digit of the number

{
public static void main(String...args)
{
System.out.println(pos(1536,6));
}
static int pos(int n,int m)
{
int i=0,rev=0,r;
while(n>0)
{
r=n%10;
rev=rev*10+r;
n=n/10;
}
while(rev>0)
{
r=rev%10;
if(r==m)
{
i++;
break;
}
rev=rev/10;
i++;
}
return i;
}
}


output:
4
User Avatar

Wiki User

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Program to find out position of digit from a number?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How do you find the position of the first digit of a quotient?

first you look at the first number tell what that number is then you just find the first digit.


Shell program to find the smallest digit of a given number?

syntax error


Which is greater 0.07 or 0.040?

Compare one digit at a time, from left to right, until you find a digit that is different. The number with the greater digit in this position is the larger number.


Find the diagonal mentod of two digit and three digit number?

find the diagonal method of two digit number and three digit number


Is 0.402 bigger than 0.428?

No. Compare equivalent digits one by one, from left to right, until you find a digit where there is a difference. In this case, the number with the bigger digit in that position is also the bigger number.


What is bigger 0.1666666667 or 0.06666666667?

Look for the first digit that is different. In this case, the first digit after the decimal point. The number that has the larger digit in this position, is larger. If the first digit is the same, compare the second digit with the second digit, the third digit with the third digit, and so forth, until you find a difference.


If the units digit and the hundreds digit of the number 513 were reversed find the sum of the original number and the new number?

"If the units digit and the hundreds digit of the number 513 were reversed..." 315 'find the sum of the original number and the new number." 513+315=828


How do you find estimated digits in a number?

The last digit is always the estimated digit in a number


The unit digit number is 3 and seven times the sum of the digit is the number itself Find the number?

It is 63.


Find the difference between the largest 8 digit number and the smallest 6 digit number?

It is 99,899,999.


The units digit of a two digit number exceeds twice the tens digit by 1 what numbers if the sum of its digit is 10?

The units digit of a two digit number exceeds twice the tens digit by 1. Find the number if the sum of its digits is 10.


Is 0.3 greater or less than 0.05?

yes