1. ## Unwanted Line

Hi,

I've finished writing a code to display the integral and fractional part of a number. It's all working fine, however, when asked to enter a number, the program continues to go down to the next line until a letter is entered. Here is the code:
Code:
```/* Intgral and Fraction */
/* By Luke Sowersby */

#include <stdio.h>
#include <conio.h>
#include <string.h>

float fraction, number;
char decision;

int Round(float number)
{
return (int)(number);
}

float fraction2(float fraction)
{
fraction=(number-Round(number));
return fraction;
}

void main(void)
{
Start:
getchar();
scanf("%f%",&number);
printf("The integral part of this fraction is: %d",Round(number));
printf("\nThe fractional part of this fraction is: %f",fraction2(fraction));
printf("\nWould you like to re-run the program? (Y or N)\n");
decision=getch();
if(decision!='Y' && decision!='N')
if(decision=='Y')
goto Start;
}```
Here is a screenshot of the problem i'm having:
http://img301.imageshack.us/my.php?i...antedlines.jpg

Thanks, Luke.

2. The problem is most likely caused by mixing getch() with getchar() and scanf() - and the first time you run the code, it will wait for getchar() to read a character - it will probably work better to do that AFTER you do scanf().

And DO NOT use GOTO!!

--
Mats

3. use int main instead of void main

4. put the getchar() after the scanf

remove the extra % after %f inside the scanf

5. Thanks, it was the extra % sign that was the problem, well spotted. Thanks for the help.

6. Code:
```char decision;

...

decision=getch();```
getch returns an int, not a char.