Pages

How to enter float values

//How to enter float values.


#include<stdio.h>
#include<conio.h>

void main()
{
  float f; //Declare the variable f
  clrscr(); //Clear the output screen
  printf("Enter the value of f:");//Show the message to user
  scanf("%f",&f); //Enter the input save into f variable
  printf("You entered: %f",f); //Show the entered value
  getch();
}

Output:

Enter the value of f:25.21021
You entered: 25.21021

No comments:

Post a Comment