Created
September 23, 2020 11:30
-
-
Save adityasuseno/ac59a29d7f6e56c33cd6857323982287 to your computer and use it in GitHub Desktop.
Print number from 1 to 100 and tell if it is Odd or Even without using Modulus
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdbool.h> | |
int main() | |
{ | |
int i; | |
bool is_even = false; | |
for ( i = 1 ; i<=100 ; i++ ) | |
if (is_even == false) | |
{ | |
printf("%d Ganjil\n", i); | |
is_even = true; | |
} | |
else | |
{ | |
printf("%d Genap\n", i); | |
is_even = false; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment