Write a function int convert () that reads a decimal number one character(digit) at a time, terminated by a blank, and returns the value of that number.
I am trying to write program for above
The code does not exit the while condition.Code:#include <stdio.h>
int main()
{
int number=0;
int digit=0;
while(digit != ' ')
{
printf("Enter the digit\n");
scanf("%d,&digit");
number = number*10 + digit;
}
printf("The entered number is=%d ",number);
return 0;
}