answersLogoWhite

0


Best Answer

#include<stdio.h>

#include<conio.h>

void main()

{

int n,d[10],i,k,s;

clrscr();

printf("enter the number..:");

scanf("%d",&n);

for(i=0,t=n;t>0;i++)

{

d[i]=t%10;

t=t/10;

}

k=i;

s=d[0];

for(i=1;i<k;i++)

{

if(d[i]<s)

s=d[i];

}

printf("\n The smallest digit is...%d",s);

getch();

}

User Avatar

Wiki User

12y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

14y ago

#include <stdio.h>

int main()

{

int input;

printf ("Enter a number ");

scanf ("%d", &input);

int digit = 0;

while (1)

{

if ( (input % 10 > 0) (input /10 > 0) )

{

digit += input % 10;

input /= 10;

} else if ( digit > 9 )

{

input = digit;

digit = 0;

}

else

{

break;

}

}

printf("Your input is condensed to %d \n\n", digit);

return 1;

}

This answer is:
User Avatar

User Avatar

Wiki User

6y ago

// returns the largest digit of num in the given base (default is base 10, decimal)int largest_digit (int num, int base=10) {

int current, digit;

current = num%base; // store least-significant digit (current largest)

while (num/=base) { // repeat until num is zero

digit=num%base; // store least-significant digit

if (current<digit) { // compare

current=digit; // update current largest

}

}

return current;

}

Example usage:

int main (void) {

int d1 = largest_digit (42); // 4

int d2 = largest_digit (123); // 3

int d3 = largest_digit (741863); // 8

int d4 = largest_digit (0xABCD, 16); // 13

return 0;

}

Note that although 13 has two digits, 13 is the decimal value of D, the largest digit in 0XABCD.

This answer is:
User Avatar

User Avatar

Wiki User

15y ago

345

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: C program to find the lowest digit of a number?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

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

syntax error


How do you find the greatest six digit number which is a perfect square?

As 1 million is the lowest 7-digit number and also the square of one thousand, the number you seek is the square of 999, which I'm sure you can calculate!


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

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


How do you find the greatest number of four digit that is divisible by 936 and 45 by finding the HCF?

It is easier to find the lowest common number, then getting the largest multiple of that that is under 10000. The LCM is 4680, x2 is 9360.


How would you find the greatest 3-digit number that is divisible by 5 and by 9.Explain your method.?

The lowest common multiple of 5 and 9 is 45 and 11 times 45 is 495 which is the greatest 3 digit number divisible by 5 and 9


How do you find estimated digits in a number?

The last digit is always the estimated digit in a number


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


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

It is 63.


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.


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.


The sum of digits of a two-digit number if five Find the number if the ten's digit is five more than the one's digit?

50