Write a program to find the integer square root of a given number.That is the largest integer whose square is less than or equal to the given number.

OK, I've written it. If you let me have your teacher's email address I can submit it for you to save you the bother of copy/pasting it yourself.

DaniWeb Member Rules (which you agreed to when you signed up) include:
"Do provide evidence of having done some work yourself if posting questions from school or work assignments"
http://www.daniweb.com/community/rules

this is not my assignment .i am actually want to preparing for exams but this question is very tough for me and in previous year this question had been asked .SO this is very important question Please Help BROTHER!!!!

Use the sqrt function from the cmath library. That gives you a double as an answer. Assign it to an integer variable.

int x = sqrt(24); // x = 4

Just giving you the code isn't going to help your ability. Memorising answers to possible questions is no way to improve, it's just a dead-end. If you want to do better in the exams then improve your programming skills by trying to code this yourself. If you try, and get stuck, then come back here and someone will help.

//Hope this Helps

#include<iostream>
using namespace std;
int main()
{
    int i=1,y=0,x=1;
    int number=0;
    cout<<"Enter Number to Find Square Root ";
    cin>>number;

    for(i=1;i*i<=number;i=i+1)
    {
        y=i*i;

        x = (i+1) * (i+1);
        if(x>number)
        {
            break;
        }

    }
    cout<<"The Square of the Number is "<<i<<endl;
    system("pause");

}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.