draw a flow chart and its corresponding c program to convert an octal number to its equivalent decimal number
Answers
Answered by
1
#include <stdio.h>
#include <math.h>
void main()
{
long int a, b = 0;
int i = 0;
printf("Enter Octal number: ");
scanf("%ld", &a);
while (a != 0)
{
b = b +(a % 10)* pow(8, i++);
a = a / 10;
}
printf("Decimal number is : %ld",b);
getch();
}
Hope this helps!
#include <math.h>
void main()
{
long int a, b = 0;
int i = 0;
printf("Enter Octal number: ");
scanf("%ld", &a);
while (a != 0)
{
b = b +(a % 10)* pow(8, i++);
a = a / 10;
}
printf("Decimal number is : %ld",b);
getch();
}
Hope this helps!
Similar questions