Find Smallest Digit of a Number C Program

C Program To Find Smallest Digit of a Number

Learn How To Find Smallest Digit of a Number in C Programming Language. This C Program To Search the Smallest Digit in an Integer makes use of Division and Modulus operators primarily. The Modulus operator is used to extract the digit at the end of a given number.


We have written two methods to Search for the Smallest Digit in a Number which includes a While Loop and a For Loop. Here, we have initialized the variable small with 10 as it is the highest value any digit in a number can be. So, whenever you fetch any digit, it can go upto 9 as its maximum value.

C Program To Find Smallest Digit of a Number using While Loop

C Code To Find The Smallest Digit in an Integer using For Loop


Output

Find Smallest Digit of a Number C Program

In case you find any error in the above C Program Code To Find Smallest Digit of a Number or if you have any doubts, let us know about it in the Comment Section below.

Recommended Programs
C Code To Find Largest Digit of a Number
Print Map of India in C Programming
C Program To Count Number of Zeros Trailing in a Number
C Program To Find Arithmetic Progression
Hexadecimal To Binary Conversion C Program
100+ C Programs For Programming Interviews

Tushar Soni

I am Tushar Soni, Co - Founder of CodingAlpha. I am a computer science student from India and passionate about Web Development and Programming. Connect with me on Facebook | LinkedIn | Google Plus

3 thoughts on “Find Smallest Digit of a Number C Program

  • July 31, 2016 at 2:31 pm
    Permalink

    To find smallest digit in an integer, why do we need to use modulus operator. I am confused with it. Please help

    Reply
    • July 31, 2016 at 8:00 pm
      Permalink

      Modulus Operator is primarily used to extract the last digit of any number. You can extract and store the last digit in any other variable. Example: temp = num%10

      Reply
  • August 21, 2016 at 12:14 pm
    Permalink

    I am not understanding the difference between Modulus and Division operator in this C Program to find smallest digit in an integer. Please help.

    Reply

Join The Discussion