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
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
Accountancy,
5 months ago
Hindi,
5 months ago
English,
10 months ago
Computer Science,
10 months ago
Business Studies,
1 year ago