How to print the '0' (zero) value after the modulo operator - % ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • babyforum
    New Member
    • Apr 2010
    • 1

    How to print the '0' (zero) value after the modulo operator - % ?

    For example, I got a simple code as below:

    #include<stdio. h>

    int main(){

    int a=15073;

    printf("The last three digit number for 'a' is %d \n", (a%1000));


    return 0;
    }


    Output
    -------------------------------
    The last three digit number for 'a' is 73.


    My question is how to display the '0' (zero) value, which display '073' instead of '73' only?
  • Markus
    Recognized Expert Expert
    • Jun 2007
    • 6092

    #2
    See this.


    Mark

    Comment

    Working...