This is my script
#include <stdio.h>
#define PI 3.14;
int main(void){
double hasil, input;
printf("Enter a positive number : ");
scanf("%lf",&input);
hasil = PI * input;
printf("\nThe result is : %lf",hasil);
getchar();
return 0;
}
I get error * must be a pointer? What's it? I mean '*' sign is to multiply number....
Your PI constant contains a semicolon which will terminate the expression prematurely;
#define PI 3.14;
...will result in the expression;
hasil = 3.14; * input;
It should be defined as only;
#define PI 3.14
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With