Program: To find largest number of given 5 numbers


    #include <iostream.h>
    void main ()
    {
        int n1 , n2 , n3 , n4 , n5 , max ;
        cout<<"Enter any five integer values :\n";
        cin>>n1>>n2>>n3>>n4>>n5;

        if (n1 > n2)
            max = n1 ;
        else
            max = n2 ;

        if (n3 > max)
            max = n3 ;
        if (n4 > max)
            max = n4 ;

        if (n5 > max)
            max = n5 ;

    cout<<"The maximum number of the given five numbers is "<<max;
    }

0 comments:

Post a Comment

 
 
 
 


Copyright © 2012 http://codeprecisely.blogspot.com. All rights reserved |Term of Use and Policies|