list of programs below: C program to convert decimal number to octal number using functions, C program to convert decimal number to octal number without functions

Octal number is a number represented using 8 symbols which are 0 – 7 numbers.

Procedure:Divide the decimal number with 8 at each step and take remainders.

eg To convert decimal number 10 to Octal

8 __| 10 __8

__| 1 – 2__

__| 0 – 1__

Now combine all remainders serially from down to up i.e 12 This is Octal number of 10 (decimal )

## Conversion of decimal number to octal program logic:

Enter decimal number n, divide n by 16 ( since Octal ) and save remainder in array and quotient in n repeat until n is greater than zero

write a C program for converting decimal number to octal number using functions

write C a program for converting decimal number to octal number using functions

#include <stdio.h>

void main()

{

int n;

printf(“\n c program for converting decimal number to octal “);

printf(“\n Enter decimal number: \n “;

scanf(“%d”,&n);

Convert_DecimalTo_Octal(n);

getch();

}

// function to convert decimal to octal

void Convert_DecimalTo_Octal(int number)

{

i=0,b[100];

while ( number>0)

{

b[i]= number%8;

number= number/8;

i++;

}

printf(“\n octal is: “);

while(i>0)

{

printf(b[i]);

i–;

}

}

#### OUTPUT:

c program for converting decimal number to octal

Enter decimal number:

12

octal is: 14

## write a C program to convert decimal number to octal number without functions

write a c program to convert decimal number to octal number without functions

#include <stdio.h>

void main()

{

int i=0,n,b[100];

printf(“\n OUTPUT: c program to convert decimal number to octal number without functions “);

printf(“\nEnter decimal number: “;

scanf(“%d”,&n);

while (n>0)

{

b[i]=n%8;

n=n/8;

i++; }

printf(“\n octal is: “);

while(i>0)

{

printf(b[i]);

i–;

}

}

#### OUTPUT:

OUTPUT: c program to convert decimal number to octal number without functions

Enter decimal number:

10

Octal is: 12

## Other programs:

Static variable scope

Register variable scope

External variable scope

Automatic variable scope

amicable number

Prime number

Perfect number

Palindrome number

Strong number

Find Factorial

Biggest Number

Average of n numbers

decimal number to octal

convert decimal number to hexadecimal

decimal number to binary

simple interest

compound interest

Add sparce matrices

Add matrices

file copying

Palindrome string

Reverse string

String length

Replace characters in string

substring or not using arrays

First occurrence of character in string

Last occurrence of character in string

Convert to uppercase

Convert to lowercase

Concatenate strings

Compare strings

Generate Employee payslips

Count students scoring marks>50%

convert weight into grams