View Single Post
Old 15-09-2007, 06:59 PM   #144 (permalink)
QwertyManiac
Commander in Chief
 
QwertyManiac's Avatar
 
Join Date: Jul 2005
Posts: 6,658
Default Re: Post ur C/C++ Programs Here

Code:
#include <stdio.h>
#include<conio.h>
void main()
{
	int a [100]; /* Array Declaration */
	int i,n,max,mini;
	printf("Enter number of elements in the array");
	scanf("%d",&n);
	for(i=0;i<n;i++)
		scanf("%d",&a[i]);
	max=a[0];
	mini=a[0];
	for(i=1;i<n;i++)
	{
		if(max<a[i])max=a[i];
		if(mini>a[i])mini=a[i];
	}
	printf("\nMaximum element in the array is %d",max);
	printf("\nMinimum element in the array is %d",mini);
getch();
}
This is the 'Turbo C' version of your program, you need to include conio.h and use getch() at the LAST line.
__________________
Harsh J
www.harshj.com
QwertyManiac is offline