A given year is a leap year if it is divisible by 4. However there are a few exceptions to this rule, if any of these years are divisible by 100 they are not leap years unless they are also divisible by 400 - so 1990 is not a leap year but 2000 is a leap year. Write a Pascal program that lists all the leap years from 1990 to 2050.

Please help me again?

Recommended Answers

All 8 Replies

What do you have so far ?

I worked it out :)

Program Program01;

Uses Crt;
Const Min=1990;
      Max=2050;
Var  Year:Array[Min..Max]Of Word; {0..65535}
     LeapYear:Array[Min..Max]Of Word;
     i,j:Word;
{Main}
Begin
      {fill the array with years}
      For i:=Min To Max Do Year[i]:=i;
      j:=Min;
      WriteLn('Leap Years:');
      For i:=Min To Max Do
         Begin
            If (Year[i] Mod 4 = 0) Or (Year[i] Mod 400 = 0) Then
               Begin
                  If (Year[i] Mod 100 <> 0 )Then  {if there are reminders}
                  Begin               {then can't divisible by 100}
                     LeapYear[j]:=Year[i];{put that number in LeapYear}
                     WriteLn(LeapYear[j]); {write the results}
                  End;
               End;
         End;
     //
     ReadKey;
End.

{
-= Note By FlamingClaw =-
good and working
-= Created By FlamingClaw =-
-=2009.03.24=-
}

Thank you for your help. But after it run, there is a new problem: Project LeapYear.exe raised exception class ElnOutEror with message 'I/O error 105' Process stopped. Use Step or Run to continue.

Is this my computer hardware problem?

what is the name for your compiler?

compiler?? Sorry, what is this?

Compiler??Sorry,what is this?

When you write a program,for the results you have to compile your program,this will check the syntax or semantics errors,if found then your program will stop and send a message by the compiler that what the problem is ....The main program like Free Pascal,Turbo Pascal,Dev Pascal...etc,got it now?

May be I want to have Pascal into my computer.

pascal is an old language,there are guys who says,leave pascal go to delphi.......according to my mind,first we have to learn the basics and then after that when you understand the loops,the arrays,records...etc,and many things that you have to know...you will see the things with other eyes...the choice is yours

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.