Advertisement
tonygms3

Untitled

Nov 5th, 2017
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.02 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3.  
  4. double square(double input1)
  5. {
  6.     printf("%.3lf\n",pow(input1,2));
  7.     return pow(input1,2);
  8. }
  9. double sqrt_1(double input1)
  10. {
  11.     printf("%.3lf\n",sqrt(input1));
  12.     return sqrt(input1);
  13. }
  14. double rem(double input1)
  15. {
  16.     printf("%.3lf\n",fmod(input1,5));
  17.     return fmod(input1,5);
  18.  
  19. }
  20.  
  21. void range_compare(double input1)
  22. {
  23.     if(input1<=100 && input1>=10)
  24.     {
  25.         printf("The number is greater than 10 but less than 100 \n");
  26.     }
  27.     else{
  28.         printf("The number is out of range\n");
  29.     }
  30.  
  31.  
  32. }
  33.  
  34. void ask_user()
  35.  
  36. {
  37.     double input1;
  38.     printf("Enter number\n");
  39.     scanf("%lf",&input1);
  40.     int input2;
  41.     range_compare(input1);
  42.     printf("Enter what you want to do\n");
  43.     printf("1 for remainder\n2 for square\n3 for square root\n");
  44.     scanf("%d",&input2);
  45.     if(input2==1)
  46.     {
  47.         rem(input1);
  48.     }
  49.     else if(input2==2)
  50.     {
  51.         square(input1);
  52.     }
  53.     else if(input2==3)
  54.     {
  55.         sqrt_1(input1);
  56.     }
  57. }
  58. int main()
  59. {
  60.     ask_user();
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.     return 0;
  68.  
  69. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement