Advertisement
Guest User

floating point ==

a guest
Sep 29th, 2012
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.24 KB | None | 0 0
  1. #include<stdio.h>
  2.  
  3. int main() {
  4.     double x = 0.0;
  5.     double y = 1.0;
  6.     int i;
  7.     for (i = 0; i < 10; i++) {
  8.         x += 0.1;
  9.     }
  10.     printf("x = %lf, y = %lf\n", x, y);
  11.     if (x == y)
  12.         printf("equal\n");
  13.     else
  14.         printf("not equal\n");
  15.     return 0;
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement