Re: Help needed



LordOfNoldor wrote:

Firstly thnak you for your interest. The question is the following:

An integer is a perfect square if it is the square of another integer.
For example, 25 is a perfect square because it is 5 x 5. Write a
program to selectively print those numbers less than 100 that are not
perfect squares. Sample output for this program should look like the
following.

2
3
5
6
7
8
10
.
.
.
99

I know to find if an input number is a perfect square or not but I just
can't get to write a program for that question. It's been hours since
I've been trying and only result i get was and endless loop:(

something like:

program psq

integer :: i

do i = 1, 99

if (.not.perfsq(i)) write(*,*)i

end do

end program

logical function perfSQ

....define a logical function that returns .true. if a perfect square

end function
--

Gary Scott
mailto:garylscott@sbcglobal dot net

Fortran Library: http://www.fortranlib.com

Support the Original G95 Project: http://www.g95.org
-OR-
Support the GNU GFortran Project: http://gcc.gnu.org/fortran/index.html

Why are there two? God only knows.


If you want to do the impossible, don't hire an expert because he knows it can't be done.

-- Henry Ford
.