How do you know the number begins and ends with the same number?



  • Can you give me an idea? I'm a little confused with the task: It's natural. Is it true that it begins and ends with the same number? First, I tried to read in the body, then count the elements in the mass to find the first and last number and then compare. But I haven't been able to finish drinking with the mass, and I think it's a bit complicated with the mass.

    What logic should be in the decision?



  • What are you doing with the masses?

    last figure - balance of 10 per cent - 10 per cent and final balance

    int mynumber=123456;
    int last=mynumber%10;
    int first=mynumber;
    for(first=mynumber;first>=10;first=first/10);        
    first = first%10;
    printf("%d  - %d",first,last);
    

Log in to reply
 

Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2