Advertisement
Guest User

Printf .123 float format

a guest
Nov 21st, 2014
465
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.20 KB | None | 0 0
  1. # include <stdio.h>
  2.  
  3. int main(int argc, char const *argv[]) {
  4.  
  5.     double value = .12345678901;
  6.  
  7.     int accuracy = 1000; // 3 digit after dot
  8.  
  9.     printf(".%d\n", (int)(value * accuracy) );
  10.  
  11.     return 0;
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement