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
520 views
in Control Statements by (29.8k points)
closed by

Write a program to check whether the given number is palindrome or not.

OR

Write a program to print the leap years between 2000 and 3000.

(A century year is leap year only if it is divided by 400 and a non century year is leap year only if it is divided by 4).

1 Answer

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

# include<iostream>

using namespace std;

int main ()

{

int n,m,rem,rev=0;

cout<<"Enter a number";

cin>>n;

m=n;

while (n)

{

   rem=n%10

   rev=rev*10+rem;

   n=n/10;

}

if(rev==m)

   cout<<"The number"<<m<<"is palindrome";

else

   cout<<"The number"<<m<<"is not palindrome";

}

OR

# include<iostream>

using namespace std;

int main ()

{

      int year;

      for (year=2000;year<=3000;year++)

  {

      if (year%100==0)

      {

       if (year%400==0)  

       cout<<year<<endl;

        }

       else

   {

      if(year%4==0)

      cout<<year<<endl;

     }

  }

}

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.

...