Advertisement
Guest User

Untitled

a guest
Oct 21st, 2014
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. //-----------------------------------------------------------------------------
  2. // hw1a.c
  3. //
  4. // Common arithmetic operators
  5. //
  6. // Group: 9 study assistant Manuel Menzinger
  7. //
  8. // Authors: Matthias Lehner 1331444
  9. //
  10. // Latest Changes: 21.10.2014 (by Matthias Lehner)
  11. //-----------------------------------------------------------------------------
  12. //
  13.  
  14. #include <stdio.h>
  15.  
  16. int main()
  17. {
  18. int sum = 1 + 2 + 3;
  19. int product = 4 * 5 * 6;
  20. int lastdigit = 7;
  21.  
  22. int result = ++product - sum++;
  23. result = result * sum;
  24.  
  25. int intdiv = result / ++lastdigit;
  26.  
  27. int rem = result % lastdigit;
  28.  
  29. float decdiv = result / (float)lastdigit;
  30.  
  31. printf("Result = %i\n", result);
  32. printf("Integer division = %i\n", intdiv);
  33. printf("Remainder = %i\n", rem);
  34. printf("Division = %.2f\n", decdiv);
  35.  
  36. return 0;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement