Get Off-Campus Placement Jobs Info !!!
Programs asked in Mettl Coding Round
Click To Practce List of Programs asked in Nagarro !!!

Program Discussion :: File

Home > Programs > File

1 / 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: