WAP to input any number and find input number is integer or not
Answers
Answered by
2
#include
#include
#include
int main()
{
char number[10];
int flag=0;
int length;
clrscr();
printf("Enter a number \n");
scanf("%s",number);
length=strlen(number);
while(length--)
{
if(number[length]=='.')
{
flag=1;
break;
}
}
if(flag)
printf("Floating point\n");
else
printf("Integer\n");
getch();
return 0;
}
#include
#include
int main()
{
char number[10];
int flag=0;
int length;
clrscr();
printf("Enter a number \n");
scanf("%s",number);
length=strlen(number);
while(length--)
{
if(number[length]=='.')
{
flag=1;
break;
}
}
if(flag)
printf("Floating point\n");
else
printf("Integer\n");
getch();
return 0;
}
Similar questions