Created
July 25, 2012 14:52
-
-
Save amichaelgrant/3176581 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 <stdlib.h> | |
#define SIZE 10 | |
int q , r , i = 0; | |
int RA[SIZE] = {1,2,3,4,5,6,7,8,9,10}; | |
int STACK_Q [SIZE] = {0}; | |
int STACK_R [SIZE] = {0}; | |
int main() | |
{ | |
printf("A program to stack up odd and even numbers!\n"); | |
for(i=0; i < SIZE; i++){ | |
if( i == 0){ | |
printf("Zero number found ==> %i\n", i); | |
continue; | |
} | |
if( i % 2 == 0)//if even | |
{ | |
STACK_Q[q] = i; | |
q++; | |
printf("Even number found ==> %i\n", i); | |
}else{ | |
STACK_R[r] = i; | |
r++; | |
printf("Odd number found ==> %i\n", i); | |
} | |
} | |
printf("Program ends!\n"); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment