accepting posative and negative values

hello there, i have a program wrought on but it will only accept positive numbers. i was wondering how can i change this so that if i enter a posative or a negative number it will work, i no i will need to put in a if or else statement, one to direct it to if its positive and one to go to the else loop if its negative
[code]
#include <stdio.h>
#include <conio.h>
void calc (long);

int main ()
{
int removelastnumber, number, mvalue, i, sumnumber=0, next , finalnumber;
char choice;
do
{
sumnumber = 0;
do
{
printf ("Enter number above zero\n");
scanf("%d",&number);

}
while (number<0 ); // number can be posative or negative
mvalue = number*9; // multiply by 9

removelastnumber = mvalue/10; // removes last number
while (removelastnumber > 0) // must be greather then zero
{
sumnumber += removelastnumber % 10;
removelastnumber = removelastnumber/10;
}
for (i=0; i < sumnumber+9; i +=9)
{
next = i;
}
int n, count=0;
n=mvalue;
while(n!=0)
{
n= n/10;
++count;
}
finalnumber =next - sumnumber;
printf("when the number %d is multiplied by 9 , the last numberi in the answer is %d\n " ,number, finalnumber ); // last number
printf("ammount of numbers in the answer is %d\n",count ); // amount of figures
getchar();
do
{
printf("To go again press y:\n");
printf("To exit program press 2\n");
scanf("%c", &choice);
}
while(choice != 'y'&& choice != '2');

}
while(choice=='y'||choice =='2');
while(choice=='y' && choice =='2');

return 0;
}
[\code]
Could you please stick to just one thread for this topic - there are multiple threads for essentially the same topic, so previous answers get lost.
Topic archived. No new replies allowed.