text keep repeating

hi there I'm at this code here for the last couple of days and final after getting it working. it only problem I keep getting is my text at the end keeps repeating its self, when I press 1 to repeat the code, the same text comes up twice, and after this it will come up with 3 lines if there's 3numbers in the number entered, or 4 lines if 4 numbers are entered, can anyone see where my problem is coming from? thanks in advanced

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
  #include <stdio.h>
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 has to be greather then zero 
     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;
        }
     finalnumber =next - sumnumber;
     printf("The last digit of the integer entered %d multiplied by 9 is %d\n " ,number, finalnumber ); 
     getchar();
     do
        {
           printf("To go again press 1:\n");
           scanf("%c", &choice);
        }
     while(choice != 'Y' && choice != 'y' && choice != 'N' && choice != 'n');
        }
     while(choice=='Y'||choice == 'y');

 printf("To exit program  press 2\n");
return 0;
}
I managed to sort some of this, only problem I have now is i what the program to exit when i press 2,
but at the moment when i press two i get two lines of code saying "to go again press1"
Please don't make repeat threats. I have already pointed you in the correct direction in your other thread.
1
2
3
4
     removelastnumber = mvalue/10; // removes last number
     while (removelastnumber > 0) // must be greather then zero 
        {
           sumnumber += removelastnumber % 10; 


what is actually you're trying to do?
Topic archived. No new replies allowed.