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

Online Exam Quiz for One day Exam Online Typing Test CCC Online Test 2026 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 Best Website and Software Company in Allahabad