#include <stdio.h>
#include <math.h>
int main(void) {
float b;
// printf("Eneter a float number");
printf("Enter a float number"); // Corrected typo fflush(stdout
); // Send the buffer to the console so the user can see it int a=0;
// a=5; -- Not required
a
=scanf("%f", &b
); // See the manual page for reading floats if (a==0) // Need comparison operator not assignemnt
{
printf("scanf error: (%d)\n",a
); // A better error message could be placed here }
else
{
printf("%g\n", b
); // Just to check the input with ideone - debugging }
return 0; // You need the semi-colon here
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxtYXRoLmg+CgppbnQgbWFpbih2b2lkKSB7CiAgICBmbG9hdCBiOwovLyAgICBwcmludGYoIkVuZXRlciBhIGZsb2F0IG51bWJlciIpOwogICAgcHJpbnRmKCJFbnRlciBhIGZsb2F0IG51bWJlciIpOyAvLyBDb3JyZWN0ZWQgdHlwbwogICAgZmZsdXNoKHN0ZG91dCk7IC8vIFNlbmQgdGhlIGJ1ZmZlciB0byB0aGUgY29uc29sZSBzbyB0aGUgdXNlciBjYW4gc2VlIGl0CiAgICBpbnQgYT0wOwovLyAgICBhPTU7IC0tIE5vdCByZXF1aXJlZAogICAgYT1zY2FuZigiJWYiLCAmYik7IC8vIFNlZSB0aGUgbWFudWFsIHBhZ2UgZm9yIHJlYWRpbmcgZmxvYXRzCiAgICBpZiAoYT09MCkgLy8gTmVlZCBjb21wYXJpc29uIG9wZXJhdG9yIG5vdCBhc3NpZ25lbW50CiAgICB7CiAgICAgICAgcHJpbnRmKCJzY2FuZiBlcnJvcjogKCVkKVxuIixhKTsgLy8gQSBiZXR0ZXIgZXJyb3IgbWVzc2FnZSBjb3VsZCBiZSBwbGFjZWQgaGVyZQogICAgfQogICAgZWxzZQogICAgewogICAgCXByaW50ZigiJWdcbiIsIGIpOyAvLyBKdXN0IHRvIGNoZWNrIHRoZSBpbnB1dCB3aXRoIGlkZW9uZSAtIGRlYnVnZ2luZwogICAgICAgIHByaW50ZigiJWcgJWcgJWciLGZsb29yKGIpLCByb3VuZChiKSwgY2VpbChiKSk7CiAgICB9CiAgICByZXR1cm4gMDsgLy8gWW91IG5lZWQgdGhlIHNlbWktY29sb24gaGVyZQp9