answersLogoWhite

0


Best Answer

#include<stdio.h>

#include<conio.h>

float SquareRoot(float num);

void main()

{

float input, ans;

clrscr();

printf("\n Enter The Number : ");

scanf("%f", &input);

ans = SquareRoot(input);

printf("\n Square Root : %f", ans);

getch();

}

float SquareRoot(float num)

{

if(num >= 0)

{

float x = num;

int i;

for(i = 0; i < 20; i ++)

x = (((x * x) + num) / (2 * x));

return x;

}

}

User Avatar

Wiki User

12y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

10y ago

#include<iostream.h>

#include<conio.h>

#include<math.h>

main()

{

int a,i=1;

cout<<"enter the nos";

cin>>a;

i=sqrt(a);

for( i=2;i<=a/2;i++)

if(a%i==0)

{

cout<<"it is prime";

}

else{

cout<<"it is not prime";

}

getch();

}

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: C program for finding square root of positive no?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

What is Dynamic Initialization in java?

Java allows us to perform 'dynamic initialization' of variables too.What this means is that you can initialize variables using expressions (as will be seen in the example).In the program, we have a int variable 'root' which has an initial defined value of 10. We then create another variable 'square' of the same data-type, which will store the square of root.//This program displays dynamic initialization in javapublicclassExample{publicstaticvoidmain(String args[]){introot=10; //root has a constant value assignedintsquare=root*root; //notice that square has "root*root" assigned to it//if u change the value of root,//the value of square changes accordingly//after each compilation//display the values of square and rootSystem.out.println("Root= " +root + " Square= "+square);}}


What is the main differences between RMS value and average value?

RMS stands for root mean square. This is done so that negative values are then treated as positive values. In AC power for example, the voltage varies between a negative and a positive value. The number is squared and then the square root of this value is taken and the mean (average) of these numbers gives the answer. For example -40 is squared to become 1600 and then the square root of 1600 is taken to become 40 (a negative number becomes a positive number).If this wasn't done then the average value of AC power would be zero.


What does sqrt function return?

square root of the argument


Are resistor heating affected by line frequency?

No. The heating effect is the product of the square of the current and resistance, where the current is a root-mean-square value.A.C. current is always expressed as a root-mean-square (r.m.s.) value, which is equivalent to a d.c. current which produces exactly the same heating effect. Root-mean-square values are affected by the shape of a waveform, but not by its frequency.


What is rms if sine wave is 20 cm peak to peak?

For a sine wave, the RMS is the amplitude divided by square root of 2. The amplitude is 10 cm. in this case; so the exact value is 10 / root(2), or about 7.For a sine wave, the RMS is the amplitude divided by square root of 2. The amplitude is 10 cm. in this case; so the exact value is 10 / root(2), or about 7.For a sine wave, the RMS is the amplitude divided by square root of 2. The amplitude is 10 cm. in this case; so the exact value is 10 / root(2), or about 7.For a sine wave, the RMS is the amplitude divided by square root of 2. The amplitude is 10 cm. in this case; so the exact value is 10 / root(2), or about 7.

Related questions

Is the square root of any real number always positive?

The square root of a real number is not always positive. The square root of any positive number is positive, the square root of zero is zero (not positive), and the square root of a negative number is complex (i.e. neither positive nor negative). The square root of 16 = -4 or 4. The square root of 0 = 0 The square root of -16 = -4i or 4i


Positive square root of 36?

+6 is the positive square root of 36.


What is the positive square root of 289?

The positive square root of 289 is 17.


What is extracting the square root?

It is the same as finding the square root.


What is the square root of a positive?

The square root of a positive number results in a positive number. For example, the square root of 25 is 5. * * * * * Not true! There are two real square roots for every positive number: one positive and one negative. -5 is as much a square root of 25 as +5 is. However, the positive root is the principal root and so is often presented as the only root.


What is the princpal of a square root?

the principal root is the positive square root.


What is positive square root of 7.3441?

Positive Square root of 7.3441 is 2.71


What does square root of 115 lie between?

The positive square root of 115 lies between the positive square roots of 114 and 116.The positive square root of 115 lies between the positive square roots of 114 and 116.The positive square root of 115 lies between the positive square roots of 114 and 116.The positive square root of 115 lies between the positive square roots of 114 and 116.


What is the square root of a square?

&radic;(a^2) That is |a| (the absolute value of a) Because if a is positive, a^2 is positive, and since &radic; is a positive square root, &radic;(a^2) is a. If a is negative, a^2 is positive, and since &radic; is a positive square root, &radic;(a^2) is -a. So if a is positive, &radic;(a^2) is positive (which is a) If a is negative, &radic;(a^2) is also positive (which is -a) So &radic;(a^2) is |a| for every a.


What is the principal square root of a positive number?

A positive number has two square roots, that is, there are two solutions to an equation like x2 = 100. The "principal square root" refers to the positive solution.


What is a principal square root?

The principal square root is the non-negative square root.


What is the Positive square root of 6724?

The square root of 6724 is 82