My program is to get (a^b)%c
.
my program -
#include <stdio.h>
#include <math.h>
double powfunction (double x, double y)
{
double answer = pow(x,y);
return answer;
}
int main()
{
int t, result, c, asign;
double a, b;
scanf("%d",&t);
for(t;t>0;t--){
scanf("%lf %lf %d",&a,&b,&c);
asign=powfunction(a,b);
printf("%d",asign%c);
}
}
I named it tt.c
. when I tried to run the program writing gcc -o tt tt.c -lm
in linux terminal it's giving the following output.
tt.c:9:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
9 | main()
| ^~~~
tt.c: In function ‘main’:
tt.c:15:12: warning: format ‘%lf’ expects argument of type ‘double *’, but argument 2 has type ‘double’ [-Wformat=]
15 | scanf("%lf %lf %d",a,b,c);
| ~~^ ~
| | |
| double * double
tt.c:15:16: warning: format ‘%lf’ expects argument of type ‘double *’, but argument 3 has type ‘double’ [-Wformat=]
15 | scanf("%lf %lf %d",a,b,c);
| ~~^ ~
| | |
| | double
| double *
tt.c:15:19: warning: format ‘%d’ expects argument of type ‘int *’, but argument 4 has type ‘int’ [-Wformat=]
15 | scanf("%lf %lf %d",a,b,c);
| ~^ ~
| | |
| int * int
pronay@MackbookPro:~$
After printing this the program is exited. Any solution for this?
I used gcc -o tt tt.c -lm
cmd to run it because someone said this is how to link the math library