-
Notifications
You must be signed in to change notification settings - Fork 0
/
math.c
61 lines (45 loc) · 1.09 KB
/
math.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#include <stdio.h>
#include <math.h>
int main()
{
int a;
int q;
double d;
printf(" 1.Odd/Even \n 2.Postive/Negative \n 3.Square of numbers \n 4.Square root of number \n");
printf("Enter the corresponding number to enter into the function \n");
scanf("%d",&a);
switch(a)
{
case 1:
printf("Enter any number:- \n");
scanf("%d",&q);
if(q % 2 == 0)
printf("%d is even.", q);
else
printf("%d is odd.", q);
break;
case 2:
printf("Enter any number:- \n");
scanf("%d",&q);
if (q <= 0) {
if (q == 0)
printf("You entered 0");
else
printf("You entered a negative number.");
}
else
printf("You entered a positive number.");
break;
case 3:
printf("enter any number: \n");
scanf("%d",&q);
printf("Square is %d",q*q);
break;
case 4:
printf("Enter any number: \n");
scanf("%lf",&d);
printf("Square root is %lf \n",sqrt(d));
}
printf("Thanks For using our program");
return 0;
}