Hi!
I have a problem with the output of the following code.
it works fine till I input a number starting with a '5'
Can anybody please tell me what exactly is the problem?
Thanks in advance
Mee.
I have a problem with the output of the following code.
Code:
#include<stdio.h>
#include<string.h>
main(){
int Number=0;
char c,*s;
int base=10;
while((c=getchar())!='\n')
{
if(atoi(&c)>0)
Number=Number*base+atoi(&c);
}
sprintf(s,"%i", Number);
printf("%s\n",s);
}
Can anybody please tell me what exactly is the problem?
Thanks in advance
Mee.
Comment