Decoding In Java ISC CBSE Class 12

import java.util.*;
class Decode{
    public static void main(){
        Scanner sc=new Scanner(System.in);
        String str,s="";
        int i,l,j,ss,r,sr=0;
        System.out.println("Enter a sentence");
        str=sc.nextLine();
        l=str.length();
        for(j=0;j<l;j++){
                if((str.charAt(j)>=65&&str.charAt(j)<=90)||(str.charAt(j)>=97&&str.charAt(j)<=122)||(str.charAt(j)==32)){
                   s=s+(int)str.charAt(j);
                }//if
            }//for j
            ss=Integer.parseInt(s);
            while(ss>0){
            for(i=0;i<=ss;i++){
                r=ss%10;
                ss/=10;
                sr=sr*10+r;
            }//i
        System.out.println("Reverse Decoded Message "+sr);
    }//while
               
               
        }//End of main
    }//End of class
       
                    

Comments

Popular posts from this blog

Sort Boundary Elements Of A Matrix

Lucky Number In Java ISC

Program to fill a square matrix of size ‘n*n” in a circular fashion (clockwise) with natural numbers from 1 to n*n, taking ‘n’ as input.