Velvet Star Monitor

Standout celebrity highlights with iconic style.

updates

GCC is showing "pow" as an undefined directory

Writer Sebastian Wright

I'm using Code::Blocks on Ubuntu 18.04. However, I'm unable to compile the following program successfully.

#include <stdio.h>
#include <string.h>
#include <math.h>
int main()
{ char binary[65]; int len, decimal, power, i; printf("Enter the binary number: "); scanf("%s", binary); decimal = 0; len = strlen(binary); power = len - 1; for (i = 0; i < len; i++) { decimal += pow(2, power); power--; } printf("Decimal value is %d\n", decimal); return 0;
}
5

1 Answer

Like so if your program name is main.c and your compiler is gcc. You open the terminal and write gcc main.c -o main -lm

0

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy