daisypolly
Programmer
Hi,
How can I read 1 character with scanf and then store all the characters in the variable.for example I am trying to do this but it doesnot work;
How can I read 1 character with scanf and then store all the characters in the variable.for example I am trying to do this but it doesnot work;
Code:
#include <stdio.h>
#include <stdlib.h>
int main()
{
char c;
float i;
int number;
float f =50;
char newchar;
while(c!='\n')
{
/* perform task */
scanf("%c",&c);
newchar=c;
number = atoi(newchar);
} ;
i=f+(float)number;
printf("%f",i );
return 0;
}