32 lines
709 B
Plaintext
32 lines
709 B
Plaintext
|
|
int main() {
|
||
|
|
printf("Testing Math Functions:\n\n");
|
||
|
|
|
||
|
|
int x = 16;
|
||
|
|
int result = sqrt(x);
|
||
|
|
printf("sqrt(16) = %d\n", result);
|
||
|
|
|
||
|
|
int p = pow(2, 8);
|
||
|
|
printf("pow(2, 8) = %d\n", p);
|
||
|
|
|
||
|
|
int a = abs(-42);
|
||
|
|
printf("abs(-42) = %d\n", a);
|
||
|
|
|
||
|
|
int f = floor(7);
|
||
|
|
printf("floor(7) = %d\n", f);
|
||
|
|
|
||
|
|
int c = ceil(7);
|
||
|
|
printf("ceil(7) = %d\n", c);
|
||
|
|
|
||
|
|
printf("\nTesting with negative numbers:\n");
|
||
|
|
int neg = -100;
|
||
|
|
int abs_neg = abs(neg);
|
||
|
|
printf("abs(-100) = %d\n", abs_neg);
|
||
|
|
|
||
|
|
printf("\nTesting pow with different values:\n");
|
||
|
|
printf("pow(3, 3) = %d\n", pow(3, 3));
|
||
|
|
printf("pow(5, 2) = %d\n", pow(5, 2));
|
||
|
|
printf("pow(10, 3) = %d\n", pow(10, 3));
|
||
|
|
|
||
|
|
return 0;
|
||
|
|
}
|