admin@onlinelearningcenter.in (+91) 7 999 01 02 03

Write a program to check if a string contains only digits.

Hardik Patel
12 Posts

Write a program to check if a string contains only digits.

Case 1 :

Input: str = “23466423”

Output: true
 
The given string contains only digits so that output is true.
 
Case 2 :
 
Input: str = “OnlineLearningCenter2020”
 
 
Output: false

The given string contains alphabet character and digits so that output is false.
Published By : Hardik Patel
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.

Comments

Jquery Comments Plugin