Advertisement
Patresss

2.5

Sep 2nd, 2014
451
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.29 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <math.h>
  4.  
  5. int main(void) {
  6.   char pi_form[10] = "\0";
  7.   int i;
  8.   for (i=0;i<7;i+=2) {
  9.     sprintf(pi_form, "%%.%dlf", i);
  10.     printf("Format %s -> ", pi_form);
  11.     strcat(pi_form, "\n");
  12.     printf(pi_form, M_PI);
  13.   }
  14.   return 0;
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement