Use app×
Join Bloom Tuition
One on One Online Tuition
JEE MAIN 2025 Foundation Course
NEET 2025 Foundation Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
0 votes
767 views
in Control Statements by (29.8k points)
closed by

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 Answer

+1 vote
by (29.6k points)
selected by
 
Best answer

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;

}

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

...