Course Content
Detailed Content of Programming in C
0/1
Introduction
0/1
Structure of C program
0/1
Answers of ‘C’ Pointers Programs
0/1
About Lesson

Skip Odd Numbers in a Loop using Continue

#include <stdio.h>

int main() {
int N;

// Taking input for N
printf(“Enter a positive integer N: “);
scanf(“%d”, &N);

// Printing even numbers and skipping odd numbers using continue in a for loop
for (int i = 1; i <= N; i++) {
if (i % 2 != 0) {
continue; // Skip odd numbers
}

printf(“%d “, i);
}

return 0;
}