fork download
  1. #include <stdio.h>
  2. #include <math.h>
  3.  
  4. int main() {
  5. int n;
  6. int i = 1;
  7.  
  8. while (scanf("%d", &n) == 1)
  9. {
  10. printf("Case %d:\n", i++);
  11. for (int i = 1; i <= (int)(sqrt((double)n)+0.00001); i++)
  12. {
  13. if (n % i == 0) printf("%d * %d\n", i, n / i);
  14. }
  15. printf("\n");
  16. }
  17. return 0;
  18. }
Success #stdin #stdout 0s 3472KB
stdin
4
12
stdout
Case 1:
1 * 4
2 * 2

Case 2:
1 * 12
2 * 6
3 * 4