fork download
  1. #include <stdio.h>
  2.  
  3. int main() {
  4. printf("Even numbers up to 10:\n");
  5.  
  6. for (int i = 2; i <= 10; i += 2) { // Increment by 2 to get even numbers
  7. printf("%d ", i);
  8. }
  9.  
  10. return 0;
  11. }
Success #stdin #stdout 0s 5288KB
stdin
Standard input is empty
stdout
Even numbers up to 10:
2 4 6 8 10