Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #define MAX_CHARACTERS 10
- int main(int argc, char **argv)
- {
- char pasword[MAX_CHARACTERS];
- int numRepetitions;
- int i;
- int repetitionsDone;
- printf("Enter the number of paswords (integer): ");
- while(numRepetitions < 1 || numRepetitions > 100){
- scanf(" %d", &numRepetitions);
- if(numRepetitions < 1 || numRepetitions > 100){
- printf("Incorrect number, try again\n");
- }
- }
- for(repetitionsDone = 0; repetitionsDone < numRepetitions; repetitionsDone++){
- printf("Enter a pasword (char sequence): ");
- for(i = 0; i < MAX_CHARACTERS; i++){
- scanf(" %c", &pasword[i]);
- }
- for(i = 0; i < MAX_CHARACTERS; i++){
- if(pasword[i] >='a' && pasword[i] <= 'z'){
- if(pasword[i] + 3 >'z'){
- pasword[i] = 'a' + (pasword[i] - 'z') -1 ;
- }
- else{
- pasword[i] = pasword[i] + 3;
- }
- }
- else{
- pasword[i] = (pasword[i]*9 + 1)%10 + '0';
- }
- }
- printf("New Password: ");
- for(i = 0; i < MAX_CHARACTERS; i++){
- printf("%c", pasword[i]);
- }
- printf("\n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement