-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathprac.c
48 lines (48 loc) · 1.07 KB
/
prac.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include<stdio.h>
void decrypt(char *c){
char *ptr = c;
while (*ptr!='\0')
{
*ptr = *ptr-1;
ptr++;
}
}
void encrypt(char *c){
char *ptr = c;
while (*ptr!='\0')
{
*ptr = *ptr+1;
ptr++;
}
}
int main(){
char password[100];
char de[100];
int n;
printf("\n\n\n");
printf("*********************Encryption and decryption program**************\n\n\n");
printf("What you want to do enter 1 for Encryption or 2 for decryption");
scanf("%d",&n);
printf("\n\n");
if (n==1)
{
printf("Enter the password: \n");
scanf("%s",password);
printf("\n\n");
encrypt(password);
printf("Your password is encrypted\n");
printf("\n\n");
printf("Your encrypted password is--\n %s\n",password);
}
else
{
printf("Enter the encrypted password\n");
scanf("%s",de);
printf("\n\n");
decrypt(de);
printf("Your real password is %s\n\n\n",de);
}
printf("\n\n\n");
printf("*********************************\n\n");
return 0;
}