sum of square root function

ddddd
Last edited on
First, plz post the code using code tag given right hand side of text area to make it clear....
to display double, you have to make data type double or float .
To add the sum of square root of numbers to previous one , modify your SumN function like this
1
2
3
4
5
6
7
float SumN(int num) {
    float sum = 0;
    for(int i = 1; i <= num; i++){
        sum += sqrt(i);
    }
    return sum;
}

where num is the number you enter
Topic archived. No new replies allowed.