Advertisement
Guest User

Untitled

a guest
Feb 24th, 2020
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. /*
  2. * Student ID: 201368218
  3. * Student Name: Alexander Dunne
  4. * Email: a.dunne2@student.liverpool.ac.uk
  5. *
  6. * User: sgadunn3
  7. *
  8. * Problem ID: 1030
  9. * RunID:
  10. * Result: Accepted
  11. */
  12.  
  13. #include <stdio.h>
  14. #include <stdlib.h>
  15. #include <math.h>
  16.  
  17. int main(int argc, char const *argv[]) {
  18.  
  19. //variables
  20. int a, b, c;
  21. float answer;
  22. int result;
  23.  
  24. //input
  25. scanf("%d %d %d", &a, &b, &c);
  26.  
  27. //calculation
  28. answer = (float)a / (float)b; //store a / b in variable answer
  29. int finalAnswer = (int)(fabsf(answer) * pow(10, 5)) % 10;
  30.  
  31. printf("%d", finalAnswer);
  32.  
  33. return 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement