Advertisement
Guest User

Untitled

a guest
Oct 20th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. #define MAX_CHARACTERS 10
  4.  
  5. int main(int argc, char **argv)
  6. {
  7. char pasword[MAX_CHARACTERS];
  8. int numRepetitions;
  9. int i;
  10. int repetitionsDone;
  11.  
  12. printf("Enter the number of paswords (integer): ");
  13. while(numRepetitions < 1 || numRepetitions > 100){
  14. scanf(" %d", &numRepetitions);
  15. if(numRepetitions < 1 || numRepetitions > 100){
  16. printf("Incorrect number, try again\n");
  17. }
  18. }
  19. for(repetitionsDone = 0; repetitionsDone < numRepetitions; repetitionsDone++){
  20. printf("Enter a pasword (char sequence): ");
  21. for(i = 0; i < MAX_CHARACTERS; i++){
  22. scanf(" %c", &pasword[i]);
  23. }
  24. for(i = 0; i < MAX_CHARACTERS; i++){
  25. if(pasword[i] >='a' && pasword[i] <= 'z'){
  26. if(pasword[i] + 3 >'z'){
  27. pasword[i] = 'a' + (pasword[i] - 'z') -1 ;
  28. }
  29. else{
  30. pasword[i] = pasword[i] + 3;
  31. }
  32. }
  33. else{
  34. pasword[i] = (pasword[i]*9 + 1)%10 + '0';
  35. }
  36. }
  37. printf("New Password: ");
  38. for(i = 0; i < MAX_CHARACTERS; i++){
  39. printf("%c", pasword[i]);
  40. }
  41. printf("\n");
  42. }
  43. return 0;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement