summaryrefslogtreecommitdiff
path: root/src/c/elementaryFunctions/radix_conversions/oct2dec/u16oct2decs.c
blob: 43dd0ac057c41c4b915b2e213a7e1af96d4dfbfd (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>

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