Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

//Sliceconvtoi ...
func Sliceconvtoi() []int {
	strs := strings.Split(sc.Text(), " ")

	var ints []int
	var x int

	for _, s := range strs {
		x, _ = strconv.Atoi(s)
		ints = append(ints, x)
	}

	return ints
}

func isLeapYear(y int) bool {
	return (y%4 == 0 && y%100 > 0) || (y%4 == 0 && y%400 == 0)
}

func cntLeap(y []int) {
	cnt := 0

	for i := y[0]; i <= y[1]; i++ {
		if isLeapYear(i) {
			cnt++
			fmt.Println(i)
		}
	}

	if cnt == 0 {
		fmt.Println("NA")
	}
}

func main() {
	num := 0

	for sc.Scan() {
		y := Sliceconvtoi()

		if y[0] == 0 && y[1] == 0 {
			break
		}

		if num > 0 {
			fmt.Println()
		}

		cntLeap(y)
		num++
	}

}

C++: #include <iostream>
#include <string>
using namespace std;

int main()
{
	int a, b;
	while (cin>>a>>b)
	{
		if ((a == 0) && (b == 0)) break;
		int flg = 0;
		while (a<=b)
		{
			if ((a % 4 == 0) && (a % 100 != 0 || a%400==0))
			{
				cout << a << endl;
				flg = 1;
			}
			a++;
		}
		if (flg==0)
		{
			cout << "NA" << endl;
		}
		cout << endl;
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
	int a,b;
	while(1){
	cin >> a >> b;&#160;
	cout << endl;
	if(a ==0 && b == 0) return 0;
	int k = 0;
	
	for(int i = a ;i<=b;i++){
		if(i % 100 == 0){
			if(i % 400 == 0){
			cout << i << endl; k++;
			}
		} else if(i % 4 == 0){
		cout << i << endl; k++;
			}
		}
		
		if(k ==0) cout << "NA" << endl ;
				
		
		}
	
	}

C++: #include <iostream>

using namespace std;

int main() {
    int a, b, n = 10000;
    while (cin >> a >> b && a != 0) {
        if (n != 10000) {
            cout << endl;
        }
        n = 0;
        for (int i = a; i <= b; i++) {
            if (i % 100 == 0) {
                if (i % 400 == 0) {
                    cout << i << endl;
                    n++;
                }
            }
            else if (i % 4 == 0) {
                cout << i << endl;
                n++;
            }
        }
        if (n == 0) {
            cout << "NA" << endl;
        }
    }

    return 0;
}

C++: #include <stdio.h>
#include <stdbool.h>

void leapyear (int year1, int year2)
{
    int i;
    int j = 0; 
    for (i = year1; i <= year2; ++i) {
        if (i % 4 == 0) {
            if (i % 100 != 0) {
                printf("%d\n", i);
                ++j;
            } else if (i % 400 == 0) {
                printf("%d\n", i);
                ++j;
            } 
        }
    }
    if (j == 0) {
        printf("NA\n");
    }

}

int main(void)
{
    while (true) {
        int year1, year2;
        scanf("%d %d", &year1, &year2);
        if (year1 == 0 && year2 == 0) {
            break;
        }
        leapyear(year1, year2);
    }
    return 0;
}

C++: #include <iostream>
using namespace std;

int uruu(int i){
  if(i%4!=0)return 0;
  else if(i%400==0)return 1;
  else if(i%100==0)return 0;
  return 1;
}

int main(){
  int a,b,k;
  while(1){
    cin>>a>>b;
    if(a==0)break;
    k=0;
    for(int i=a+1;i<b;i++){
      if(uruu(i)){k++;cout<<i<<endl;}
      
    }
    if(k==0)cout<<"NA"<<endl;
    cout<<endl;
  }
  return 0;
}

C++: #include <stdio.h>
	
void uruu(int first, int end)
{
	int count = 0;
	for (int i = first; i < end + 1; i++) {	
		if (i % 400 == 0) {
			printf("%d\n", i);
			count = count + 1;
		} else if (i % 100 == 0) {
			i = i + 3;
		} else if (i % 4 == 0) {
			printf("%d\n", i);
			count = count + 1;
		}
	}
	if (count == 0) {
		printf("NA\n");
	}
}
	
int main(void)
{	
	int first, end;
	while (1) {
		scanf("%d %d", &first, &end);
		if (first == 0 && end == 0) {
			break;
		} else {
			printf("\n");
			uruu(first, end);
		}
	}
        printf("\n");
	return 0;
}

C++: #include <stdio.h>

int main(){

	int a,b;
	int i;
	int answer[1000];
	int count;

	while(1){

		count = 0;

		scanf("%d %d",&a,&b);

		if(a == 0 && b == 0){
			break;
		}

		for(i = a; i < b; i++){
			if(i % 4 == 0){
				if(i % 100 == 0){
					if(i % 400 == 0){	
						answer[count] = i;
						count ++;
					}
				}else{
					
						answer[count] = i;
						count ++;
				}
			}
		}

		for(i = 0; i < count; i++){
			printf("%d\n",answer[i]);
		}

		if(count == 0){
			printf("NA\n");
		}
	}

	return 0;
}

C++: /*
    2014.07.04 1230~1243
    C language Lecture week ∞
*/

#include <stdio.h>

int leap_chk ( int year );

int main (void) {
    
    int init;
    int last;
    
    int rcode = 0;
    
    int count;
    
    while (1) {
        
        count = 0;
        
        scanf ( "%d", &init );
        scanf ( "%d", &last );
        
        if ( init == 0 && last == 0 ) {
            break;
        }
        
        if ( rcode == 0 ) {
            rcode = 1;
        } else {
            printf ( "\n" );
        }
        
        for ( int ly = init; ly <= last; ly ++ ) {
            if ( leap_chk ( ly ) ) {
                printf ( "%d\n", ly );
                count ++;
            }
        }
        
        if ( count == 0 ) {
            printf ( "NA\n" );
        }
        
    }
    
    return 0;
    
}

int leap_chk ( int year ) {
    
    if ( year % 4 == 0 ) {
        if ( year % 100 == 0 ) {
            if ( year % 400 == 0 ) {
                return 1;
            } else {
                return 0;
            }
        } else {
            return 1;
        }
    } else {
        return 0;
    }
    
}

C++: #include<stdio.h>
    
int leap_year(int x);
        
int main(void)
{
    int start_year, end_year, counter;
    while(1){
        scanf("%d %d", &start_year, &end_year);
        if(start_year == 0 && end_year == 0){
            break;
        }else{
            counter = 0;
            for(int i = start_year; i <= end_year; i++){
                counter += leap_year(i); 
                }
            if( counter == 0){
                printf("NA\n");
            } 
        }
        printf("\r\n");
    }
    return 0;
}
    
    
int leap_year(int x)
{
    if((x % 4 == 0 && !(x % 100 == 0)) || x % 400 == 0){
        printf("%d\n", x);
        return 1;
    }
    return 0;
}

C++: #include <stdio.h>

void Leap_Year(int start_year, int end_year)
{
    while ((start_year != 0) || (end_year != 0)) {
        if (end_year - start_year < 3) {
            if (((start_year % 4) < (end_year % 4)) || ((start_year % 100) > (end_year % 100))) { 
                if ((start_year % 400) < (end_year % 400)) {
                    printf("NA\n");
                } else {
                    printf("%d\n", start_year + 4 - start_year % 4);
                }
            }
        } else {
            for (int i = start_year; i <= end_year; ++i) {
                if (i % 400 != 0) {
                    if ((i % 100 != 0) && (i % 4 == 0)) {
                        printf("%d\n", i);
                    }
                } else {
                    printf("%d\n", i);
                }
            }
        }
        printf("\n");
        scanf("%d %d", &start_year, &end_year);
    }
}

int main(void)
{
    
    int start_year, end_year;
    scanf("%d %d", &start_year, &end_year);
    Leap_Year(start_year, end_year);
    return 0;
}

C++: # include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <unordered_map>

using namespace std;
using LL = long long;

constexpr int MOD = 1000000000 + 7;
constexpr int INF = 2000000000;

int main() {
	int a, b;
	while (cin >> a >> b&&a&&b) {
		int count = 0;
		for (int i = a; i <= b; i++) {
			if (i % 4 == 0) {
				if (i % 100 != 0) {
					cout << i << endl;
					count++;
				}
				else {
					if (i % 400 == 0) {
						cout << i << endl;
						count++;
					}
				}
			}
		}
		if (count == 0) {
			cout << "NA" << endl;
		}
		cout << endl;
	}
}