Answer to Question #198519 in C for Prasanna

Question #198519

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.


1
Expert's answer
2021-05-26T06:54:40-0400
#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;
}





Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS