Advertisement
PM32

Cifrado Cesar

Dec 9th, 2016
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.39 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4.  
  5. #define DELTA 5
  6.  
  7. int main()
  8. {
  9.     char string[128], string2[128];
  10.    
  11.     scanf("%s", string);
  12.    
  13.     int len = strlen(string);
  14.    
  15.     int i;
  16.     char c;
  17.    
  18.     for(i = 0; i < len; i++)
  19.     {
  20.         c = string[i] + DELTA;
  21.        
  22.         if(c > 'Z')
  23.             c = 'A' + (c - 'Z');
  24.            
  25.         string2[i] = c;
  26.     }
  27.    
  28.     string[i] = 0;
  29.     puts(string);
  30.     exit(EXIT_SUCCESS);
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement