Skip to content

Instantly share code, notes, and snippets.

@amichaelgrant
Created July 25, 2012 14:52
Show Gist options
  • Save amichaelgrant/3176581 to your computer and use it in GitHub Desktop.
Save amichaelgrant/3176581 to your computer and use it in GitHub Desktop.
#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