[ create a new paste ] login | about

Link: http://codepad.org/RGgCYA1h    [ raw code | output | fork | 1 comment ]

C, pasted on Aug 22:
#include<stdio.h>
#include<conio.h>


int main()
{
	int i, n;
	int min;
	//min = 1;
	do
	{
	printf("\nNhap n: ");
	scanf("%d", &n);
	}while(n < 0 && printf("\nLoi: n >= 0 !"));
	min = n % 10;  // khởi tạo min
	if(n == 0)
		min = 0;

	do
	{
		i = n % 10;
	   if(i < min)
	   {
		   min = i;
	   }
	}while(n /= 10);

	printf("\nChu so nho nhat la %d", min);

	getch();
	return 0;
}


Output:
1
Line 17: error: conio.h: No such file or directory


Create a new paste based on this one


Comments:
posted by mouto9k on Nov 15
min=9;
if(cs<min)
min=cs;
reply