[Updated] Goldman Sachs Aptitude Test Questions and Answers
Practice List of TCS Digital Coding Questions !!!
Take 50+ FREE!! Online Data Interpretation Mock test to crack any Exams.

Program Discussion :: File

Home > Programs > File

348 / 1

WAP in C/JAVA taking Input from a File and Counting the Number os Spaces , Capital Letters, Small Letters , Vowels , Special Characters etc.

Answer:

import java.io.*; 

public class Count{ 



    static void countCharacterType(String str) 

    { 

     

        int vowels = 0, consonant = 0, specialChar = 0,  

            digit = 0; 

      

      

        for (int i = 0; i < str.length(); i++) { 

             char ch = str.charAt(i); 

      

            if ( (ch >= 'a' && ch = 'A' && ch = '0' && ch 

Asked In ::

Post Your Answer Here:

Language:

Post Your Reply Here: