//Position and value of smallest number in an array
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int array[100],small=32767,n,loc=-1;
printf("Enter no. of values: ");
scanf("%d",&n);
printf("Enter Values:\n");
for(int i=0;i<n;i++)
{
printf("value %d: ",i+1);
scanf("%d",&array[i]);
if(array[i]<small)
{
small=array[i];
loc=i;
}
}
printf("Smallest Value is: %d\n",small);
printf("Position of smallest value: %d",loc+1);
getch();
}
//program written by Mars.
.thank you for sharing useful post.
ReplyDeleteweb programming tutorial
welookups