Question

ABBA's tribal leader does not know how to count. In exchange for one of his lands,...

ABBA's tribal leader does not know how to count. In exchange for one of his lands, another tribe asked him to choose one of three heaps of gold coins. But the ABBA's tribal leader wants to get as much as possible gold coins. Help the leader to make the right decision!

Note. The program has to use the pointer.

Input:
First-line contains 3 numbers that are not more than 10100

Output:
The maximum number of coins that can be taked.

Samples:

INPUT OUTPUT
1 5 7 3 7
2 987531 234 86364 987531
3 189285 283 4958439238923098349024 4958439238923098349024

Homework Answers

Answer #1

since the program is to be implemented using Pointers, I have used C language

#include<stdio.h>

int main(){

long long int num1,num2,num3;

long long int *ptr1,*ptr2,*ptr3;

scanf("%lld %lld %lld",&num1,&num2,&num3);

ptr1 = &num1;

ptr2 = &num2;

ptr3 = &num3;

if(*ptr1 > *ptr2) {

if(*ptr1 > *ptr3)

{

printf("%lld",*ptr1);

}

else{

printf("%lld",*ptr3);

}

}

else{

if(*ptr2 > *ptr3){

printf("%lld",*ptr2);

}

else{

printf("%lld",*ptr3);

}

}

return 0;

}

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Pinky and The Brain are great friends. They like to play games with numbers. This time,...
Pinky and The Brain are great friends. They like to play games with numbers. This time, Pinky has given The Brain a list of numbers and given him the task of determining if it is possible to choose a subset of them such that they sum is equal to another given number. Build an algorithm using dynamic programming to help The Brain with his problem. INPUT The first line corresponds to N, the amount of numbers given by Pinky The...
1.The sample mean is an unbiased estimator for the population mean. This means: The sample mean...
1.The sample mean is an unbiased estimator for the population mean. This means: The sample mean always equals the population mean. The average sample mean, over all possible samples, equals the population mean. The sample mean will only vary a little from the population mean. The sample mean has a normal distribution. 2.Which of the following statements is CORRECTabout the sampling distribution of the sample mean: The standard error of the sample mean will decrease as the sample size increases....
      MK Restaurant: Branding of Thai-Style Hotpot The restaurant industry is one of the most...
      MK Restaurant: Branding of Thai-Style Hotpot The restaurant industry is one of the most competitive in Thailand. With a large number of players ranging from restaurants in five-star hotels, global fast-food chains to small stalls along the streets and everything in between, the Thais are spoiled for choice. In addition, as the world becomes globalized, consumers are familiar with international dishes and would not hesitate to try new offerings from the other side of the globe. As a...
Using the model proposed by Lafley and Charan, analyze how Apigee was able to drive innovation....
Using the model proposed by Lafley and Charan, analyze how Apigee was able to drive innovation. case:    W17400 APIGEE: PEOPLE MANAGEMENT PRACTICES AND THE CHALLENGE OF GROWTH Ranjeet Nambudiri, S. Ramnarayan, and Catherine Xavier wrote this case solely to provide material for class discussion. The authors do not intend to illustrate either effective or ineffective handling of a managerial situation. The authors may have disguised certain names and other identifying information to protect confidentiality. This publication may not be...
What tools could AA leaders have used to increase their awareness of internal and external issues?...
What tools could AA leaders have used to increase their awareness of internal and external issues? ???ALASKA AIRLINES: NAVIGATING CHANGE In the autumn of 2007, Alaska Airlines executives adjourned at the end of a long and stressful day in the midst of a multi-day strategic planning session. Most headed outside to relax, unwind and enjoy a bonfire on the shore of Semiahmoo Spit, outside the meeting venue in Blaine, a seaport town in northwest Washington state. Meanwhile, several members of...