Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function Encoding_ceaser()
- msg='Enter the message to encode 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 encode 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 encoded message : ');
- disp( plainText);
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement