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
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;
}
The code does not exit the while condition.