在线编译器 C

#include <stdio.h> int main() { int a,c,min=10,max=0,pro; scanf("%d",&a); while(a>0&&a<1000000000) { c=a%10; a=a/10; if(c<min) { min=c; } if(c>max) { max=c; } } pro=min*max; printf("%d ",min); printf("%d ",max); printf("%d",pro); return 0; }
1) This code reads an integer, then finds its smallest and largest digits. Finally, it calculates and prints the product of these two digits along with the digits themselves.

2) Hint: Consider what happens when the input number contains a zero digit. Also, think about whether the initial values for min (10) and max (0) work for all possible valid inputs.