Puzzle 4 Answer

28/07/2008 14:19

 

Logic :

1. Read Three Numbers,

2. Find Out The Difference Between The First Two Numbers

3. Add Two Numbers Along With The Difference.

4. Divide The Sum By Two, This Will Gives The Bigger Number.

5. Now Find The Difference Between The Bigger Number & The Third Number.

6. Repeat The Step 3,4.

7. Print The Biggest Number.

 

 

#include<stdio.h>

#include<math.h>

int main()

{

int First_Num,Second_Num,Third_Num,Biggest;

unsigned int Difference;

printf("Enter The First Number Is :");

scanf("%d",&First_Num);

printf("Enter The Second Number Is :");

scanf("%d",&Second_Num);

printf("Enter The Third Number Is :");

scanf("%d",&Third_Num);

Difference=abs(First_Num - Second_Num);

Biggest=((First_Num+Second_Num+Difference)/2);

Difference=abs(Biggest - Third_Num);

printf("The Biggest Number Is :%d", (Biggest + Third_Num + Difference) /2);

return 0;

}

sahaya.webnode.comĀ© 2008 All rights reserved.

Make a free websiteWebnode