Increment value and display in C
The main reason your counter increases so quickly is that you probably hold it down for about 1 second and the while loop is executed about 100 times during that time. So it will increase the counter by about 100.

What you really want is to only increase the counter once each time it's pressed down. A solution is shown below. The while loop remembers the last state of the button. The if clause is then only executed if the state goes from 0 to 1. It will no longer be executed when the previous value is 1, i.e. the button state hasn't changed but was just kept pressed down.

#include "mbed.h"
#include "TextLCD.h"

DigitalIn ip(D7);
TextLCD lcd(A0, A1, A2, A3, A4, A5);

int i = 0;
int lastButtonValue = 0;

int main() {
    lcd.cls();
    lcd.locate(0,0);
    lcd.printf("COUNT:");
    lcd.locate(0,1);
    lcd.printf("%d",i);

    while(1) {
        if (lastButtonValue == 0 &amp;&amp; ip == 1) {
            lcd.locate(0,1);
            lcd.printf("%d", ++i);
        }
        lastButtonValue = ip;
    }
}