Program in C does not work, problem with gpp-compiler? While using long double


I’m working in Atom using the gpp-compiler. I’m using long doubles as data entry in a pretty simple program, but when I compile I only see zeros as a result. I’m really clueless with what the problem could be. Could anyone help me? I think that the code is correct, so I’m assuming that the problem is the compiler, but I have no idea on how to verify if this is the case.

Here’s the code:

    Write a program in a file called “VOL.C” which uses the area code from “AREA.C”. In addition
    to the radius, it prompts for a height with which it calculates the volume of a cylinder. The
    formula is volume = area * height.
    Here notice how an especially long string may be broken over two lines, providing double
    quotes are placed around each part of the string.

#include <stdio.h>

int main(void)
    long double radius = 0.0L;
    long double height = 0.0L;
    long double volume = 0.0L;
    const long double pi = 3.1415926353890L;

    printf("please give the radius and height ");
    scanf("%Lf %Lf", &radius, &height);

    volume = pi * radius * radius * height;

    printf("Volume of cylinder with radius %.3Lf "
    "and height %.3Lf is %.12Lf\n",
    radius, height, volume);

    return 0;

Thanks in advance.


You can double-check the code using a different compiler, such as this REPL. It does indeed appear to work. When you say that you just get zeroes, do you mean that the text displays correctly and the numbers in the final message are zeroes, or that the output is all just zeroes?


Prints out the message correctly. But what informs is just zeros. I will try using another compiler and I’ll let you know if that’s the problem.

Thank you.


Ok. I tried out the code in the alternative compiler you provided and it worked. So my guess is that the problem is in the Atom’s gpp-compiler. How can I inform about this issue to its developer?


The GitHub repo is the appropriate place to get in contact.