Friday, June 13, 2008

Find smallest of several integers

/*Write a prog. that finds the smallest of several integers.Assume that the first value read specifies the number of values remaining*/

#include <stdio.h>

int main(void)
{
int i ,m ,temp,n1,n2 = 0,n3 = 0 ;
printf("Enter how many numbers you want to enter : ");
scanf("%d",&i);
for ( m = 1 ; m <= i ; m++ )
{
printf("Enter your number :");
scanf("%d",&n1);
n3 = n1 ;
if ( temp < n3)
n2 = temp;
else
n2 = n3;
temp = n2 ;
}
printf("Smallest number of all %d series is %d ",i,n2);
}

No comments: