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

CCC Online Test Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Online Exam Quiz O Level NIELIT Study material and Quiz Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Best Website and Software Company in Allahabad Website development Company in Allahabad