Programming Examples

Arduino program to print the square root of a given number


sqrt in Arduino

Arduino program to  print the square root of a given number

Solution


void setup() {
  Serial.begin(9600);  
}

void loop() {
  if (Serial.available() > 0) {
  float number = Serial.parseFloat();
  float squareRootValue = sqrt(number);
  Serial.print("Square Root of ");
  Serial.print(number);
  Serial.print(" is: ");
  Serial.println(squareRootValue);

  }
}
Output

Square Root of 25.00 is: 5.00

Latest Current Affairs 2024 Online Exam Quiz for One day Exam Online Typing Test CCC Online Test 2024 Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Best Java Training Institute in Prayagraj (Allahabad) Best Python Training Institute in Prayagraj (Allahabad) O Level Online Test in Hindi Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Sarkari Naukari Notification Best Website and Software Company in Allahabad Sarkari Exam Quiz