Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

scanf in c for 2 float numbers not working

Ungureanu RazvanUngureanu Razvan Member Posts: 1

can anyone help me whit this code

include <stdio.h>

define PI 3.14

int main()
{

float diameter;
float height;
float radius;
float surfaceArea;

printf("Please enter a diameter: ");
scanf("%f",&diameter);
printf("Please enter a height: ");
scanf("%f",&height);

printf("\nDiameter is %f, and height is %f\n", diameter, height);
radius = diameter /2;
printf("...calculating, please wait...\n");
surfaceArea=(2*PI*(radius*radius))+(2*PI*radius*height);
printf("The surface area of your cylinder is %.3f\n", surfaceArea); */

return 0;
}

when i try to run it it only ask me for the first number and jumps the second scanf....

Sign In or Register to comment.