Question: You are given a string s 1 . You need to check whether a string contains only digits or not. If the string contains only

You are given a string s1. You need to check whether a string contains only digits or not. If the string contains only digits then the string operation returns YES, otherwise, retur The function IsDigit() accepts the parameters string s1. Complete the function isDigit() that returns the check digit in boolean format. Print whether YES or NO based on the
Example:
If the string s1 is 1232459 then the string consists of only digits and hence the operation returns true. If the string-checking operation returns true then print YES, otherwise
Constraints:
1<=s1.size<=1000
Example 1:
Input: s1-34533r92384
Output:
check_string= NO
Example 2:
Input:
$1=12098335272261
Output:
Check_string = YES

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!