Advertisement
Guest User

Untitled

a guest
Mar 21st, 2019
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdbool.h>
  3. #include <stdlib.h>
  4. #include <math.h>
  5. #define SIZE 100
  6.  
  7. int main()
  8. {
  9. char sign;
  10. int whole;
  11. double frac;
  12. double a;
  13. bool plus;
  14. print("Enter your number: ");
  15. scanf("%d", a);
  16. print("\n");
  17. if(a > 0)
  18. {
  19. plus = true;
  20. }
  21. else if (a < 0)
  22. {
  23. plus = false;
  24. }
  25. else
  26. {
  27. sign = '0';
  28. }
  29. int cele = a;
  30. whole = cele;
  31. double qwe;
  32. qwe = a - whole;
  33. qwe = qwe*10;
  34. int cele2 = qwe;
  35. frac = cele2;
  36. printf("Sign = ");
  37. if(plus == true)
  38. {
  39. printf ("+");
  40. }
  41. else if(plus == false)
  42. {
  43. printf ("-");
  44. }
  45. else
  46. {
  47. printf(sign);
  48. }
  49. printf("\n");
  50. printf("Whole = ");
  51. printf(whole);
  52. printf("\n");
  53. printf("Frac = ");
  54. printf(frac);
  55. return 0;
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement