Advertisement
Guest User

Untitled

a guest
Mar 29th, 2015
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.37 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdio.h>
  3. #include <string.h>
  4.  
  5. int main(void) {
  6.     char a[80];
  7.     int rotation, len, i;
  8.  
  9.     printf("Your string? ");
  10.     gets(a);
  11.  
  12.     printf("Rotation? ");
  13.     scanf("%d", &rotation);
  14.  
  15.     len = strlen(a);
  16.  
  17.     for (i = 0; i < len; i++) {
  18.         if (a[i] >= 97 && a[i] <= 122) {
  19.             a[i] += rotation;
  20.         }
  21.     }
  22.  
  23.     printf("Result: %s\n", a);
  24.  
  25.     return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement