C pgm to find the number entered is int or float???

nim's Avatar, Join Date: Sep 2009
nim
Newbie Member
Hi,
Please help me with C code to find the number entered is integer or float?????

Thanks in advence.
0
xpi0t0s's Avatar, Join Date: Aug 2004
Mentor
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?
0
mrvool's Avatar, Join Date: Aug 2012
Newbie Member
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();
}

Last edited by shabbir; 18Aug2012 at 11:22.. Reason: Code blocks