Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function Decoding_ceaser()
- msg='Enter the message to decode it : ';
- plainText=input( msg , 's');
- for i =1 : length(plainText)
- if ( plainText(i)>="A" && plainText(i)<="Z")
- continue ;
- elseif (plainText(i) ~=" " )
- disp('can not be decode this message ')
- return ;
- end
- end
- k = input('Enter the value of K : ');
- k = mod(k , 26 );
- for i =1 : length(plainText)
- if (plainText(i) ~=" " )
- plainText(i)= mod(plainText(i)-'A' - k , 26) +'a';
- end
- end
- disp('the original message : ');
- disp( plainText);
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement