Code no: 1 = Using only main function to perform task. #include <iostream> using namespace std; int main() { int number,original,digit,reverse=0; cout<<"Enter any number : "; cin>>number; original=number; while (number!=0) { digit=number%10; reverse=(reverse*10)+digit; number=number/10; } if (original==reverse) { cout<<"This "<<original<<" is Palindrome number."; } else { cout<<"The "<<original<<" is not Palindrome number."; } } Result: Code no: 2 = Using two functions to perform same task. #include <iostream> using namespace std; int isprime(int num) { int digit=0,reverse=0; while (num!=0) { digit=num%10; reverse=(reverse*10)+digit; num/=10; } return reverse; } int main() { int num; cout<<"Enter any digit to find its sum = "; cin>>num; int original=num; if (i...
I am Cyber Security student in Air University, Islamabad. I upload different codes and their results of C++ and Bash scripting and some other cyber projects and hacking with its proof. I am innovative of mind and dextrous of hand.
Comments
Post a Comment