Tuesday, 17 June 2014

C++ program to print perfect square number between 1 to n


Here is a C++ program to print perfect square number between 1 to n


 SOURCE CODE OUTPUT
#include<iostream>
using namespace std;
int main()
{
       int num;
       cout<<"Enter the value ";
       cin>>num;
       for(int i=1;i*i<=num;i++)
            cout<<i*i<<" ";
       return 0;
}

Any questions regarding to program please write in comments.

No comments:

Post a Comment