summaryrefslogtreecommitdiff
path: root/src/c/elementaryFunctions/radix_conversions/dec2oct/i8dec2octs.c
blob: 30ae5b021362dffec94525b731159f47669aaba2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <string.h>
#include <math.h>
#include "dec2oct.h"
#include <stdio.h>

void i8dec2octs(int8 in,int8* out)
{
	int i=0,j=0,tmp=0;
	int quotient;
	quotient=(int)in;
	while(quotient!=0)
	{
		out[i++]= quotient%8;
        	quotient=quotient/8;
	}
	j=i-1;
	i=0;
	
	while(i<j)
	{
		tmp=out[i];
		out[i]=out[j];
		out[j]=tmp;
		i++;
		j--;
	}	
}