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

nim
Newbie Member
26Sep2009,01:10   #1
nim's Avatar
Hi,
Please help me with C code to find the number entered is integer or float?????

Thanks in advence.
Mentor
26Sep2009,12:50   #2
xpi0t0s's Avatar
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?
Newbie Member
18Aug2012,09:57   #3
mrvool's Avatar
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