/*Serial No.83 [swami57.cpp]*/
#include<stdio.h>
#include<conio.h>
void main()
{
int k;
int a[5],i,j,max=0,min=0;
printf("Enter how many numbers in array:=");
scanf("%d",&k);
printf("enter the numbers:\n");
for(i=0;i<k;i++)
{
scanf("%d",&a[i]);
}
max=a[0];
min=a[0];
for(i=1;i<k;i++)
{
if(a[i]>max)
{
max=a[i];
}
if(a[i]<min)
{
min=a[i];
}
}
printf("Maximum value of array:=%d\n",max);
printf("Minimum value of array:=%d",min);
getch();
}
#include<stdio.h>
#include<conio.h>
void main()
{
int k;
int a[5],i,j,max=0,min=0;
printf("Enter how many numbers in array:=");
scanf("%d",&k);
printf("enter the numbers:\n");
for(i=0;i<k;i++)
{
scanf("%d",&a[i]);
}
max=a[0];
min=a[0];
for(i=1;i<k;i++)
{
if(a[i]>max)
{
max=a[i];
}
if(a[i]<min)
{
min=a[i];
}
}
printf("Maximum value of array:=%d\n",max);
printf("Minimum value of array:=%d",min);
getch();
}
No comments:
Post a Comment
If you have any doubt, feel free to ask...