Here is the code
//WAP in Co convert a binary or octal to a decimal number depending on user choice.
#include <stdio.h>
#include <math.h>
int conversion(int number,int base);
int main(void){
int number,base,decimal;
char choice;
printf("Enter the number:");
scanf("%d",&number);
printf("Enter 'b' for binary or 'o' for octal:");
scanf("%c",&choice); //Problem occuring here
if(choice=='b')
base=2;
base=8;
decimal=conversion(number,base);
printf("Decimal number:%d",decimal);
return 0;
}
int conversion(int number,int base){
int reminder;
int decimal=1;
int i=0;
while(number>=0){
reminder=number%base;
decimal=(decimal*reminder)*pow(base,i);
number/=10;
i++;
}
return decimal;
}