Dain1234 / Java-Programming

0 stars 0 forks source link

Special Characters #29

Open Dain1234 opened 1 year ago

Dain1234 commented 1 year ago

package com.dain.logics;

import java.util.Scanner;

public class Special_char { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("Enter the String:"); String string = sc.nextLine(); int len = string.length(); char Char[] = new char[len]; int Special = 0; for (int i = 0; i < len; i++) { Char[i] = string.charAt(i); if (Char[i] >= 65 && Char[i] <= 90 || Char[i] >= 97 && Char[i] <= 122 || Char[i] >= 48 && Char[i] <= 57) {

        } else {
            Special++;
            System.out.println(Char[i]);
        }
    }
}

}