CODE:
#include<stdio.h>
#include<conio.h>
void main()
{
int max,i,n,a[10],min;
clrscr();
printf("Enter size of array");
scanf("%d",&n);
for(i=0;i<n;i++)
{
printf("Enter a[%d] ",i);
scanf("%d",&a[i]);
}
max=a[0];
for(i=1;i<5;i++)
{
if(a[i]>max)
{
max=a[i];
}
}
printf("Maximum is %d",max);
min=a[0];
for(i=0;i<n;i++)
{
if(a[i]<min)
{
min=a[i];
}
}
printf("Minimum is %d",min);
getch();
}
#include<stdio.h>
#include<conio.h>
void main()
{
int max,i,n,a[10],min;
clrscr();
printf("Enter size of array");
scanf("%d",&n);
for(i=0;i<n;i++)
{
printf("Enter a[%d] ",i);
scanf("%d",&a[i]);
}
max=a[0];
for(i=1;i<5;i++)
{
if(a[i]>max)
{
max=a[i];
}
}
printf("Maximum is %d",max);
min=a[0];
for(i=0;i<n;i++)
{
if(a[i]<min)
{
min=a[i];
}
}
printf("Minimum is %d",min);
getch();
}
No comments:
Post a Comment