Get Email Subscription

Enter your email address:

Delivered by FeedBurner

Thursday, March 11, 2010

Find highest, median and lowest number from the given set of 17 numbers.

The Big Short: Inside the Doomsday Machine
Write a program in C to input 17 observation and then print highest, median and lowest.
#include<stdio.h>
#define N 17
void main( )
{
int i, j, n[N], t;
printf("Enter %d integer values\n", N);
for (i=0; i < N; i++) scanf("%d", &n[i]); for(i=0; i < N-1; i++) for (j=i+1; j < N; j++) if (n[i] > n[j])
{
t = n[i];
n[i] = n[j];
n[j] = t;
}
printf("Highest number is %d", n[16]);
printf("Median is %d\n", n[8]);
printf("Lowest number is %d", n[0]);
getch( );
}

Related Posts by Categories



0 comments:

About This Blog

Lorem Ipsum

  © Blogger templates Newspaper III by Ourblogtemplates.com 2008

Back to TOP