// include the library code:
long p;
long q;
long r;
long s;
long x;
long y;
#include <LiquidCrystal.h>
#include <Arduino.h>
#include <Keypad.h>
// initialize the library by associating any needed LCD interface pin
// with the arduino pin number it is connected to
const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 6, d0 = 23, d1 = 22, d2 = 0, d3 = 1;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
void setup() {
lcd.begin(16, 2);
lcd.print("Try to solve the");
lcd.setCursor(0,1);
lcd.print("Questions...");
delay(5000);
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Be loyal...");
delay(5000);
lcd.clear();
}
void loop() {
// set the cursor to column 0, line 1
// (note: line 1 is the second row, since counting begins with 0):
// Print a message to the LCD.
p=random(9,100);
q=random(9,100);
r=random(9,100);
lcd.setCursor(0,0);
lcd.print(p);
lcd.setCursor(3,0);
lcd.print('+');
lcd.setCursor(5,0);
lcd.print(q);
lcd.setCursor(8,0);
lcd.print('-');
lcd.setCursor(10,0);
lcd.print(r);
delay(15000);
y=(p+q-r);
lcd.setCursor(0,1);
lcd.print("Answer:");
lcd.setCursor(7,1);
lcd.print(y);
delay(5000);
lcd.clear();
}