answersLogoWhite

0


Best Answer

#include<stdio.h>

int main()

{

int d,j=1,i,flag=0,count=0,k=0;

int b[];

char a[],c;

printf("enter the number=");

scanf("%s",a);

printf("enter the digit=");

scanf("%c",&c);

printf("the place value of given digit is:");

for(i=0;a[i]!='\0';i++)

{

if(a[i]==c)

{

b[k]==a[i]-'0';

b[k]=b[k]=*j;

flag=1;

count++;

k++;

}

j=j*10;

}

if(flag==1)

{

printf("the place value of given digit %c is:",c);

for(i=0;i<count;i++)

printf("\n%d",b[i]);

}

else

printf("your entered digit is not present in number");

return 0;

}

User Avatar

Wiki User

11y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What to do to write a c program to input a number then a digit and findout the place value of that digit?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

How to write a java program to extract the last digit from the input?

Assuming you've entered a multi-digit number whole number (an integer), then take the modus (%) of the number and 10. E.g., if the number input was 1234, then 1234 % 10 is 4. Thus the final digit is 4. Note that modus 10 is the same as dividing the number by 10 and taking the remainder.


Java script program to Print the Fibonacci series using array?

&lt;script type = "text/javascript"&gt; var input; var rev = 0; input=window.prompt ("Please enter a 5-digit number to be reversed."); input = input * 1; while (input &gt; 0) { rev *= 10; rev += input % 10; input /= 10; } document.write ("Reversed number: " + rev); &lt;/script&gt;


Which code i need to delete middle digit in 3 digit number in c plus plus?

If you know that the number input will always be three digits: output = 10 * (int)(input / 100) + (input % 10); If you want to idiot proof it (eg. too many digits): output = 10 * (int)((input % 1000) / 100) + (input % 10);


How do you write a Java program to accept a 3-digits integer number and print out the highest digit from the derived input?

The tricky part is getting the individual digits. There are basically two ways to do this: 1) Convert the number to a string, and use string manipulation to get the individual digits. 2) Repeatedly divide the number by 10. The digit is the remainder (use the "%" operator). To actually get the highest digit, initially assume that the highest digit is zero (store this to a variable, called "maxDigit" or something similar). If you find a higher digit, replace maxDigit by that.


C program to find the lowest digit of a number?

#include&lt;stdio.h&gt; #include&lt;conio.h&gt; void main() { int n,d[10],i,k,s; clrscr(); printf("enter the number..:"); scanf("%d",&amp;n); for(i=0,t=n;t&gt;0;i++) { d[i]=t%10; t=t/10; } k=i; s=d[0]; for(i=1;i&lt;k;i++) { if(d[i]&lt;s) s=d[i]; } printf("\n The smallest digit is...%d",s); getch(); }

Related questions

How to write a java program to extract the last digit from the input?

Assuming you've entered a multi-digit number whole number (an integer), then take the modus (%) of the number and 10. E.g., if the number input was 1234, then 1234 % 10 is 4. Thus the final digit is 4. Note that modus 10 is the same as dividing the number by 10 and taking the remainder.


Java script program to Print the Fibonacci series using array?

&lt;script type = "text/javascript"&gt; var input; var rev = 0; input=window.prompt ("Please enter a 5-digit number to be reversed."); input = input * 1; while (input &gt; 0) { rev *= 10; rev += input % 10; input /= 10; } document.write ("Reversed number: " + rev); &lt;/script&gt;


If a five digit number is input through the keyboard write a program to calculate the sum of its digits?

If a five-digit number is input through the keyboard, write a program to print a new number by adding one to each of its digits. For example if the number that is input is 12391 then the output should be displayed as 23402. //Author::Mudasir Yaqoob..... #include&lt;stdio.h&gt; #include&lt;conio.h&gt; int main() { long number,t; int i=0; long temp[5]; printf("Enter the five digit number:\n\n"); scanf("%ld",&amp;number); while(i&lt;=4) { t=number%10+1; temp[i]=t; number=number/10; i++; } printf("Reverse number\n\n\n\n"); for(i=4;i&gt;=0;i--) { printf("%ld",temp[i]); } getch(); }


Which code i need to delete middle digit in 3 digit number in c plus plus?

If you know that the number input will always be three digits: output = 10 * (int)(input / 100) + (input % 10); If you want to idiot proof it (eg. too many digits): output = 10 * (int)((input % 1000) / 100) + (input % 10);


What is the biggest number you can write on Windows vistas calculator before you get Invalid input for function?

A 12 digit number.


If a 4 digit number is input through keyboard Wap to obtain a sum of the first and last digit their number?

#include&lt;stdio.h&gt; #include&lt;conio.h&gt; void main() { int


How do you write a Java program to accept a 3-digits integer number and print out the highest digit from the derived input?

The tricky part is getting the individual digits. There are basically two ways to do this: 1) Convert the number to a string, and use string manipulation to get the individual digits. 2) Repeatedly divide the number by 10. The digit is the remainder (use the "%" operator). To actually get the highest digit, initially assume that the highest digit is zero (store this to a variable, called "maxDigit" or something similar). If you find a higher digit, replace maxDigit by that.


C program to find the lowest digit of a number?

#include&lt;stdio.h&gt; #include&lt;conio.h&gt; void main() { int n,d[10],i,k,s; clrscr(); printf("enter the number..:"); scanf("%d",&amp;n); for(i=0,t=n;t&gt;0;i++) { d[i]=t%10; t=t/10; } k=i; s=d[0]; for(i=1;i&lt;k;i++) { if(d[i]&lt;s) s=d[i]; } printf("\n The smallest digit is...%d",s); getch(); }


What program can read n number must contain four- digits only and if the second left digit odd put it in an array if not ignore it?

Input the number as a string. If the string has a length of 4 and contains only digits, convert the string to an integer. If the integer is less than 1000, input another number. Otherwise, copy the integer and divide by 100 to get rid of the two least-significant digits. Divide again by 2 and take the remainder. If the remainder is 1 then the second left digit of the 4-digit integer is odd and the 4-digit integer can be added to the array, otherwise do not add it. Repeat for all n numbers.


An assembly language program that will take three decimal input and display minimum of them?

program that take three decimal number as input and find the largest among them in assembly language


What is legal input?

In a computer program, a legal input is something that can be put into a program and it will work. An illegal input may crash the program.


How do you write a looping program to check whether input is a buzz number or not?

Buzz numbers are aircraft identification numbers that were applied to American aircraft following the second world war and through the 1960's. To determine if an input is a buzz number or not, the input must consist of a two- or three-letter manufacturing code and a 3-digit number, separated by a hyphen. The digits are generally the last three digits of the aircraft serial number. Validating the manufacturing code is relatively simple given there were only 173 issued. However, validating the three-digit code would be impossible without a complete list of all aircraft that were assigned a buzz number. If such a list exists, storing them in sequential order would allow your program to perform a fast binary search to determine if the input were valid or not. In the absence of such a list, the manufacturing code alone would at least tell you which type of aircraft the buzz number (if valid) would have applied to.