Skip to content

Instantly share code, notes, and snippets.

@devvspaces
Created October 4, 2022 15:05
Show Gist options
  • Select an option

  • Save devvspaces/9cb4263c4a19d8ce2f63ee6766e221b2 to your computer and use it in GitHub Desktop.

Select an option

Save devvspaces/9cb4263c4a19d8ce2f63ee6766e221b2 to your computer and use it in GitHub Desktop.
Program to print odd numbers ranging from 1 - 30 😎
// Program to print odd numbers ranging from 1 - 30 😎
void main() {
// Loop on numbers range 1 - 30
for (int pointer = 1; pointer <= 30; pointer++){
// Check if value is an odd number or even
if (pointer % 2 != 0) {
print(pointer);
continue;
}
if (pointer == 30){
print("The number is at $pointer");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment