Dremendo Tag Line

Input 2 integers and print the sum of their square roots using mathematical functions in C

Mathematical Functions - Question 2

In this question, we will see how to input two integer numbers and print the sum of their square roots in C programming using the mathematical functions. To know more about mathematical functions click on the mathematical functions lesson.

Q2) Write a program in C to input two integer numbers and print the sum of their square roots using the sqrt() function.

Program

#include <stdio.h>
#include <conio.h>
#include <math.h>

int main()
{
    int a,b;
    double s;
    printf("Enter 2 integer numbers\n");
    scanf("%d%d",&a,&b);
    s=sqrt(a) + sqrt(b);
    printf("Sum of the square root = %lf",s);
    return 0;
}

Output

Enter 2 integer numbers
25
9
Sum of the square root = 8.000000
video-poster