1.

What is isdigit()? Give example.

Answer»

This function is used to check whether a given character is a digit or not. This function will return 1 if the given character is a digit, and 0 otherwise.

Example:

using namespace std;

#include

#include int main( )

{

char ch;

cout <<“\n Enter a Character:”; cin>> ch;

cout << “\n The Return Value of isdigit(ch) is << isdigit(ch);

}

Output – 1

Enter a Character: 3

The Return Value of isdigit(ch) is : 1

Output – 2

Enter a Character: A

The Return Value of isdigit(ch) is :0



Discussion

No Comment Found