summaryrefslogtreecommitdiff
path: root/2.3-1/src/c/elementaryFunctions/radix_conversions/oct2dec/i16oct2decs.c
blob: ea0928528b83a0afa0b4a3cab22197c6b94cd3c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <string.h>
#include "oct2dec.h"
#include <stdio.h>
#include <math.h>

int16 i16oct2decs(int16 in) /* Function to convert octal to decimal */
{
	int n=0,rem=0, base=1;
	int16 out=0;
	n=(int)in;
	while (n!=0)
        {
    	    rem = n%10;
	    out = out + (rem * base);
            n = n / 10 ;
            base = base * 8;
        }
	return out;
}