Easiest Way to Convert Decimal Numbers to Octal Number in C Programming Language

in #programming8 years ago

// Codes that will take input from the user in Decimal & convert it into Octal in C programming language


int main ()
{
int num, re,re2,sum=0, oct = 0;
printf("Decimal: ");
scanf("%d", &num);#include <stdio.h>

while (num > 0)
{
    re = num % 8;
    oct = (oct * 10) + re;
    num = num / 8;
}


while (oct>0)
{
    re2 = oct % 10;

    sum = (sum * 10) + re2;
    oct = oct / 10;
}
printf("Octal: %d\n", sum);

}

Sort:  

Good

thanks sweetheart

tor mayre baap :v

tor fadar madar

vai asob ki likhsen mia ??

he he mia 69 likhle vlo hoito

Excecelent Post

thanks vai

Peace, Abundance, and Liberty Network (PALnet) Discord Channel. It's a completely public and open space to all members of the Steemit community who voluntarily choose to be there.Congratulations! This post has been upvoted from the communal account, @minnowsupport, by riyasaat from the Minnow Support Project. It's a witness project run by aggroed, ausbitbank, teamsteem, theprophet0, and someguy123. The goal is to help Steemit grow by supporting Minnows and creating a social network. Please find us in the

If you like what we're doing please upvote this comment so we can continue to build the community account that's supporting all members.