Advertisement
nguyenhappy92

Tìm chữ số nhỏ nhất của số nguyên dương n

Oct 6th, 2015
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. // Tim chu so nho nhat cua so nguyen duong n
  2. // Khai bao thu vien
  3.  
  4. #include<stdio.h>
  5. #include<conio.h>
  6.  
  7. void main()
  8. {
  9. int n;
  10. scanf("%d",&n);
  11. int a;
  12. int min=n%10;
  13. while(n!=0)
  14. {
  15. a=n%10;
  16. if(a<min)
  17. {
  18. min=a;
  19. }
  20. n=n/10;
  21. }
  22. printf("%d",min);
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement