Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
#include <stdio.h>
#include <string.h>
#include <ctype.h>
bool IsInteger( char *number )
{
int len = strlen( number );
bool isnumber = true;
int i = 0;
while( i < len && isnumber )
{
if( isdigit( number[i] ) == 0 )
{
if( number[i] == '+' || number[i] == '-' )
{
if( i + 1 > len - 1 || i - 1 >= 0 )
{
isnumber = false;
}
}
if( number[i] != '+' && number[i] != '-' )
{
isnumber = false;
}
}
i++;
}
return isnumber;
}
void main()
{
char number[20];
printf("Enter a number: ");
gets(number);
while( strlen( number ) == 0 )
{
printf("Please enter some input first:\n");
gets(number);
}
if( IsInteger( number ) == false )
printf("This is not a number.\n");
else
printf("Thanks for entering a number !\n");
}