Design a C program to exchange the keys. The Two friends Bob and Jim met in a bank and discussed about their secret code. They decided to exchange their passwords for further transactions. Password of Bob is "Apple" and Jim is Orange". Print the password of Jim and Bob.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main() {
//Password of Bob is "Apple" and Jim is Orange"
char BobPassword[]="Apple";
char JimPassword[]="Orange";
// exchange the keys
char temp[10];
strcpy(temp,BobPassword);
strcpy(BobPassword,JimPassword);
strcpy(JimPassword,temp);
printf("Bob password: %s\n",BobPassword);
printf("Jim password: %s\n",JimPassword);
getchar();
getchar();
return 0;
}
Comments
Leave a comment