Saturday, 31 October 2015

C++ Program To  Find Max Number Among Given Three Number

Problem :- Write A Program To  Find Max Number Among Given Three Number

Logic :- This Is a different logic to find max number among three number .

Step 1:- we use forth variable as 'max' and store first element in max then compare max to next to element 

Step 2 :- if second number is greater than max then store second number in max if it is less then compare with third element

Step 3 :- If third number is greater then store third element in max if condition fails then first number is greater

Solution :- 

using namespace std;
int main()
  int x,y,z,max;

  cout<<"Enter The Three Numbers \n";

if (y>max)
cout<<"\nThe Greatest Number In Given Numbers "<<x<<" "<<y<<"  "<<z<<" is "<<max;



C++ Program To  Find Max Number Among Given Three Number

Ghanendra Yadav
Ghanendra Yadav

I Am Ghanendra Yadav Owner Of This Website. I Love Programming, Web Developing, Logo Making, Banner And Website designing. Currently I Am Studying In NIT Warangal And Also Working With WSDC( As Web Application Developer ) In NIT Warangal For Any Query Mail Me I Will Answer Within 24 Hours Email:-

Find me on Social Media

Facebook | Twitter | Google+ | RSS Feed

No comments:

Post a Comment