fork download
  1. #include <stdio.h>
  2.  
  3. int main() {
  4. int N, digit;
  5.  
  6. // Input the number
  7. printf("Enter a natural number: ");
  8. scanf("%d", &N);
  9.  
  10. // Process each digit
  11. while (N > 0) {
  12. digit = N % 10; // Extract the last digit
  13.  
  14. // Check if the digit is not a square of 2 (1 or 4)
  15. if (digit != 1 && digit != 4) {
  16. printf("%d ", digit); // Print the digit
  17. }
  18.  
  19. N = N / 10; // Remove the last digit
  20. }
  21.  
  22. return 0;
  23. }
Success #stdin #stdout 0.01s 5280KB
stdin
132421565134
stdout
Enter a natural number: