Tuesday 14 August 2012

Loop control structure023

Input five numbers and find the high value with position.

#include <stdio.h>
#include <conio.h>

void main ( )
{
            int         co, n, g = 0, p = 0;
            clrscr ( );
                         
            for ( co = 1; co <= 5; co++ )
            {                                      
                            printf ("\n\t Enter a number......:"); scanf ("%d", &n);
                            if ( n > g )
                            {                  
                                      g = n;
                                      p = co;
                            }
            }
            printf ("\n\t High Value = %d and Position = %d", g, p);
            getch ( );
}

Click here to contact us

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...