#include<stdio.h>
void main()
{
int x,i=1,small,p;
while(i<=10)
{
printf("Enter %d no = ",i);
scanf("%d",&x);
if(x<small)
{
small=x;
p=i;
}
i++;
}
printf("smallest no = %d,position = %d", small,p);
}
1 Replies - 4574 Views - Last Post: 18 February 2008 - 08:58 AM
#1
finding smallest number among given numbers using While Loop in C lang
Posted 18 February 2008 - 08:49 AM
Replies To: finding smallest number among given numbers using While Loop in C lang
#2
Re: finding smallest number among given numbers using While Loop in C lang
Posted 18 February 2008 - 08:58 AM
please explain the problem you are facing, that will help us to help you. 
btw, the problem that I can see here is that you haven't initialized small to the smallest number.
initialize small with smallest possible integer before while loop. and still if there are any problems then post it here [with proper explanation of course]
btw, the problem that I can see here is that you haven't initialized small to the smallest number.
initialize small with smallest possible integer before while loop. and still if there are any problems then post it here [with proper explanation of course]
This post has been edited by AmitTheInfinity: 18 February 2008 - 09:10 AM
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote



|