Re: Help needed
- From: Gary Scott <garylscott@xxxxxxxxxxxxx>
- Date: Sun, 29 Oct 2006 18:29:41 GMT
Gary Scott wrote:
LordOfNoldor wrote:oops ...and .false. if not true
Firstly thnak you for your interest. The question is the following:something like:
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:(
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
.
- References:
- Help needed
- From: LordOfNoldor
- Re: Help needed
- From: Gary Scott
- Re: Help needed
- From: LordOfNoldor
- Re: Help needed
- From: Gary Scott
- Help needed
- Prev by Date: Re: Help needed
- Next by Date: Re: Help needed
- Previous by thread: Re: Help needed
- Next by thread: Re: Help needed
- Index(es):
Relevant Pages
|
|