Advertisement
thenewboston

C Programming Tutorial - 12 - Math Operators

Aug 22nd, 2014
504
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.40 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main()
  5. {
  6.     int weight = 165;
  7.     printf("If I eat this watermelon I will weigh %d lbs \n", weight + 12);
  8.  
  9.     int a = 86;
  10.     int b = 21;
  11.     printf("%d \n", a/b); //if you use integers on both sides of division, result is integer value
  12.  
  13.     float c = 86.0;
  14.     float d = 21.0;
  15.  
  16.     printf("%f \n", c/d);
  17.     printf("%d \n", a%b);
  18.  
  19.     return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement