Question #29599

wite a c++ program to print all integers from 1 to 20 and their square roots.

Expert's answer

#include <stdio.h>

#include <math.h>

int main() {

for (int i = 1; i <= 20; i++) {

printf("square root of %d is %.6lf\n", i, sqrt(i));

}

return 0;

}

#include <math.h>

int main() {

for (int i = 1; i <= 20; i++) {

printf("square root of %d is %.6lf\n", i, sqrt(i));

}

return 0;

}

## Comments

## Leave a comment