Онлайн компилятор C

#include <stdio.h> void main() { int n; scanf("%d ",&n); int max=0; int b=n; while(b>0){ int t=b%10; b=b/10; if(t>max){ max=t; } } int mini=9; int v=n; while(v>0){ int k=v%10; v=v/10; if(k<mini){ mini=k; } } printf("%d",mini*max); }
1) This code reads an integer, finds its largest and smallest digits, then prints the product of those two digits.

2) Hint: Trace through the code with a sample input like 352 to see how the modulus and division operations extract each digit.
Hint: Consider what happens if the input contains a zero digit and how that affects the smallest digit calculation.