I'm a begginer in C programm and I've tried to do some exercices in order to learn how to programm. I did a lot of small and simple programms, but one of this I had a trouble. I can't compile it. I'm a linux user (linux mint) and I'm using VS Code too. The terminal show me a trouble with the 'ceil'. How is the right way to use the 'ceil'? Someone can help me? Many thanks.
You can see my code below:
#include <stdio.h>
#include <math.h>
int main(void){
float pi = 3.14159;
float raio, area, renTinta, qtdTinta, qtdLata;
float arredonda_pcima = 0.0;
printf("\nQual o raio da mesa?(medida em metros)\n");
scanf("%f", &raio);
printf("\nQual o rendimento da tinta?(padrão 5m/L\n");
scanf("%f", &renTinta);
area = pi * ( raio * raio );
qtdTinta = area / renTinta;
qtdLata = qtdTinta / 10;
arredonda_pcima = ceil(qtdLata);
printf("\npara uma mesa de raio %.2f e área de %.2f será consumido %.2f de tinta e será(ão) necessária(as) %.0f latas\n\n", raio, area, qtdTinta, arredonda_pcima );
return 0;
}
I receive the message by terminal...
Executing task: /usr/bin/gcc -g '/home/gilmar/Documents/Projeto FAC em C/fac16.c' -o '/home/gilmar/Documents/Projeto FAC em C/fac16' <
/tmp/cctqUJ2D.o: In function
main': /home/gilmar/Documents/Projeto FAC em C/fac16.c:19: undefined reference to
ceil' collect2: error: ld returned 1 exit status The terminal process terminated with exit code: 1
Terminal will be reused by tasks, press any key to close it.