Advertisement
Guest User

Untitled

a guest
Jan 19th, 2020
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <math.h>
  4.  
  5.  
  6. void num();
  7. void plusOrMinus(int number, int length);
  8.  
  9. int main()
  10. {
  11. num();
  12.  
  13. return 0;
  14. }
  15.  
  16. /*
  17. This function gets a number,
  18. counts the amount of digits it
  19. has and sends it to plusOrMinus.
  20. */
  21. void num()
  22. {
  23. int length = 0; //setting variables
  24. int number = 0;
  25. int numberBackup = 0;
  26.  
  27. printf("Please enter a whole number: "); //getting a number
  28. scanf("%d", &number);
  29. getchar();
  30.  
  31. numberBackup = number;
  32. while(anumberBackup != 0)
  33. {
  34. numberBackup = numberBackup/10;
  35. length++;
  36. }
  37.  
  38. plusOrMinus(number, length);
  39. }
  40.  
  41.  
  42. /*
  43. This function checks if the
  44. number is positive negative or zero
  45. */
  46. plusOrMinus(int number, int length);
  47. {
  48. char num[]
  49.  
  50.  
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement