string-related Operations ———— 2015 Xiaomi written test content

Source: Internet
Author: User

This is a millet company 2015 of the written question:

Palindrome Number: A string from the previous look and look back if the same, is a palindrome string. For example, "Shanghai tap water from Shanghai" is a palindrome string. Now, think of a number as a string and ask if he is a palindrome?

Example: 12321-True 3->ture 133434-> false

#include <stdio.h> #include <stdlib.h>bool ispalindromenumber (long num) {Long temp = Num;long X=0;while (temp !=0) {x = temp%10 + x*10;temp = TEMP/10;} if (x = = num) {return true;} Else{return false;}} int main () {long test1=12344321;long Test2=1234567;bool re1,re2;re1 = Ispalindromenumber (test1); Re2 = Ispalindromenumber (test2);p rintf ("%d\n%d\n", Re1,re2); System ("pause"); return 0;}

string-related Operations ———— 2015 Xiaomi written test content

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.