Write a program to input a number to find and display its square and cube root.
Answers
Answer:
c program to find square root of a given number
Method 1: Using inbuilt sqrt() function: The sqrt() function returns the sqrt of any number N.
Method 2: Using Binary Search: This approach is used to find the square root of the given number N with precision upto 5 decimal places.
Method 3: Using log2(): The square-root of a number N can be calculated using log2() as:
Answer:
#include<iosteam.h>
#include<stdlib.h>
#include<conio.h>
void main()
{
int x,s,c;
cout<<"Enter the value";
cin>>x;
s=x*x;
c=x*x*x;
cout<<"Square="<<s;
cout<<"cube="<<c;
getch();
}
Explanation:
In this program, x stand for unknown vgalue which you have to give when you compile your program
s stand for square of a number and c stands for cube of a number
If you want the output of the program
You are free to ask
My WhatsApp no. 9973825001