MASTER OF COMPUTER APPLICATIONS
Course Code: MCS-011
Course Title : Problem Solving and Programming
Assignment Number : MCA(1)/011/Assign/2017-18
Maximum Marks : 100
Weightage : 25%
Draw a flow chart and write its corresponding C program to convert an octal number to its equivalent decimal number.- IGNOU MCA Assignment 2017 – 18
Flowchart:
#include<stdio.h>
#include<math.h>
void main ()
{
int oct,dec=0,i=0;
clrscr();
printf(“Enter any Octal number : “);
scanf(“%d”,&oct);
while(oct!=0)
{
dec=dec+(oct%10)*pow(8,i++);
oct=oct/10;
}
printf(“Decimal = %d\n”, dec);
getch();
}
Code:
[codesyntax lang=”c”]
#include<stdio.h>
#include<math.h>
void main ()
{
int oct,dec=0,i=0;
clrscr();
printf(“Enter any Octal number : “);
scanf(“%d”,&oct);
while(oct!=0)
{
dec=dec+(oct%10)*pow(8,i++);
oct=oct/10;
}
printf(“Decimal = %d\n”, dec);
getch();
}
[/codesyntax]
Screen Shots: