5th sem OOPJ Write a program to count the number of words that start with capital letters.

import java.io.*;

/**
 *
 * @author Yash
 */

class pra6{
    public static void main(String arg[]) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
       
        int num=0;
        System.out.println("Write a line :");
        String str  = br.readLine();
       
        for(int i=0;i<str.length();i++){
            if(Character.isUpperCase(str.charAt(i))){
             num++;
            }
        }
        System.out.println("The Number of Upper case is : "+num);
    }  
}

Comments

Popular posts from this blog

Javascript Lab 2

JavaScript Lab 3

5th sem OOPJ Write a program that calculates percentage marks of the student if marks of 6 subjects are given.