FANDOM


/* LAB QUIZ 3 BY KEVIN DUKE*/ 
#include <stdio.h>
#define ARRAYSIZE 10
 
char reversefunction(int x[], int y[])
{
  int counter;
  int countbackwards;
  countbackwards = ARRAYSIZE-1;
  counter=0; 
  while (counter <= ARRAYSIZE-1)
    {
      y[countbackwards] = x[counter];
	 counter++;
	 countbackwards--;
	}
  return y[ARRAYSIZE];
}
 
int main (void)
{
int x[ARRAYSIZE];
int y[ARRAYSIZE];
int counter;
char arrayinput;
 
arrayinput=0;
counter=0;
 while(counter <= ARRAYSIZE-1 && arrayinput != '$')
  {
    scanf("%c", &arrayinput);
    if (arrayinput == '$')
      {}
    else
      {
	x[counter] = arrayinput;
	counter++;
      }
 
  }
  counter=0;
  while( counter <= ARRAYSIZE-1 )
   {
     if (arrayinput == '$')
       {}
     else
       {
     printf("%c", x[counter]);
     counter++;
       }
   }
  printf("\n");
  reversefunction(x, y);
  counter=0;
  while( counter <= ARRAYSIZE-1 )
   {
     printf("%c", y[counter]);
	 counter++;
   }
printf("\n");
  return 0;
}