Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <math.h>
- double square(double input1)
- {
- printf("%.3lf\n",pow(input1,2));
- return pow(input1,2);
- }
- double sqrt_1(double input1)
- {
- printf("%.3lf\n",sqrt(input1));
- return sqrt(input1);
- }
- double rem(double input1)
- {
- printf("%.3lf\n",fmod(input1,5));
- return fmod(input1,5);
- }
- void range_compare(double input1)
- {
- if(input1<=100 && input1>=10)
- {
- printf("The number is greater than 10 but less than 100 \n");
- }
- else{
- printf("The number is out of range\n");
- }
- }
- void ask_user()
- {
- double input1;
- printf("Enter number\n");
- scanf("%lf",&input1);
- int input2;
- range_compare(input1);
- printf("Enter what you want to do\n");
- printf("1 for remainder\n2 for square\n3 for square root\n");
- scanf("%d",&input2);
- if(input2==1)
- {
- rem(input1);
- }
- else if(input2==2)
- {
- square(input1);
- }
- else if(input2==3)
- {
- sqrt_1(input1);
- }
- }
- int main()
- {
- ask_user();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement