Computer Science, asked by yrsmhm, 10 months ago

A number is called a Cyclo number if its first and last digit is same. Input a number and
verify whether it is a Cyclo Number or not. For example : 52145

Answers

Answered by T70StOrM
1

#include <iostream>

using namespace std;

int main()

{

   int ipNum, lNum, fNum;

   /*

       ipNum = input number

       lNum = last number

       fnum = fist number

   */

   cout << "Enter a number: ";

   cin >> ipNum;

   

   lNum = ipNum % 10;

   

   while (ipNum != 0)

   {

       fNum = ipNum % 10;

       ipNum = ipNum / 10;

   }

   if (fNum == lNum)

   {

       cout << "The given number is a cyclo number.";

   }

   

}

Similar questions