Search This Blog

Friday, April 22, 2011

CODE 06

//GAURAV MITTAL(2K9/EE/830)
//QUESTION 6. Find the minimum and maxuimum out of given set of numbers.

#include
#include


int main()
{

int x[20];
int n,i;
int smallest=32767,largest=0;
printf("\n\nEnter the number of terms : ");
scanf("%d",&n);
printf("\n\n\n");

for(i=0;i {
printf("Term no. %d",i+1," : ");
printf(" : ");
scanf("%d",&x[i]);
}


for(i=0;i {
if(x[i] smallest=x[i];

if(x[i]>largest)
largest=x[i];
}

printf("\nLargest Term %d",largest);
printf("\nSmallest Term %d",smallest);

getch();
return 0;
}

No comments:

Post a Comment