# 1. Write a C++ program to display all leap years between 1000 and 2000 excluding all century years.

285 views

closed

1. Write a C++ program to display all leap years between 1000 and 2000 excluding all century years.

OR

2. Write a C++ program to find the sum of the first 10 numbers of Fibonacci series. (Fibonacci series is 0, 1, 1,2, 3, 5, 8, 15 where 0 and 1 are the first two terms and reamaining terms are obtained by the sum of the two preceding terms.)

+1 vote
by (31.3k points)
selected by

1.

# include<iostream>

using namespace std;

int main ()

{

int i;

cout<<"Leap years between 1000 and 2000 is given below \n";

for (i=1000,i<=2000;i++)

{

if (i % 100 = = 0)

{

if (i % 400 = = 0)

cout<<i<<",";

}

else if  (i % 4 = = 0)

cout<<i<<",";

}

}

OR

2.

# include<iostream>

using namespace std;

void main ()

{

int i, fib1=0, fib2=1, fib3, S;

S = fib1 + fib2;

for(i=1, i <=8;i++)

{

fib3 =fib1 + fib2;

S = S + fib3;

fib1=fib2;

fib2 =fib3;

}

cout<<"The sum of first 10 numbers of Fibonacii series is "<<s;

}