English, asked by sravya0077, 3 months ago

write an algorithm to help the system identify the court of digits present in the username​

Answers

Answered by 7011352324
1

Answer:

eurhujfjfufjfurkrjrurk jejeurikeiriekehiorkrjrirrjrieor jrjrkrieorkjrirkriruor

Explanation:

❤❤❤❤❤❤❤

Answered by dreamrob
4

Algorithm:

Step 1: Start

Step 2: Declare a string variable s to take the input from the user.

Step 3: Take input in the variable s from the user.

Step 4: Find the length of the string in variable l.

Step 5: Start a loop from i = 0 to i < l

Step 6: Extract each character from the string one after the other.

Step 7: Check whether the ASCII of character is in between the ASCII of digits.

ASCII of 0 = 48

ASCII of 9 = 57

Step 8: If ASCII fall in between the range then increment the counter by 1.

Step 9: Loop end

Step 10: Print the count

Step 11: End

Program in Java:

import java.util.*;

public class MyClass

{

   public static void main(String args[])

   {

       Scanner Sc = new Scanner(System.in);

       String s;

       System.out.print("Enter a username : ");

       s = Sc.nextLine();

       int l = s.length();

       int count = 0;

       for(int i = 0 ; i < l ; i++)

       {

           char ch = s.charAt(i);

           if(ch >= 48 && ch <= 57)

           {

               count++;

           }

       }

       System.out.print("Total number of digits present in the username : " + count);

   }

}

Output:

Enter a username : rs_riya_6291

Total number of digits present in the username : 4

Similar questions