We will get Square root of a given number by using sqrt() function. We can format the out put by using printf().
#include <stdio.h>
#include <math.h>
int main(void){
float num; // num is declared as float variable
num=225;     // data is stored
printf("num = %.4f", sqrt(num)); // final output
return 0;
The above code will give this output.
num = 15.0000

Example integer output

int main(void){
int num; // num is declared as integer  variable
num=sqrt(625);     // data is stored
printf("num = %d", num); // final output
return 0;
Output is here
num = 25


* indicates required
Subscribe to plus2net


    Post your comments , suggestion , error , requirements etc here

    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2022 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer