Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   C pgm to find the number entered is int or float??? (http://www.go4expert.com/forums/c-pgm-entered-int-float-t19557/)

nim 26Sep2009 01:10

C pgm to find the number entered is int or float???
 
Hi,
Please help me with C code to find the number entered is integer or float?????

Thanks in advence.

xpi0t0s 26Sep2009 12:50

Re: C pgm to find the number entered is int or float???
 
First of all have you decided how to determine whether a number is integer or float? If you haven't done this yet then you won't be able to write a program to do it.
If you've decided that, have you started yet? What code do you have? Does it work? If not, what does it do wrong? What input did you give and what output did you get?

mrvool 18Aug2012 09:57

Re: C pgm to find the number entered is int or float???
 
hi Dear,
Please try this code easy and simple....

Code:

#include <stdio.h>
#include <conio.h>
void main()
{
float f;
int i;
printf("Enter a number : ");
scanf("%f",&f);
i=f;
if(i==f)
    printf("\nYou have Enterd an Intiger number");
else
    printf("\nYou have Enterd a float number");
getch();
}



All times are GMT +5.5. The time now is 06:39.