1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
docker41 [41]
3 years ago
10

Find every number from 1 to n (inclusive) that is a palindrome which starts with the digit 3. Do not user a helper function.

Computers and Technology
1 answer:
Mkey [24]3 years ago
7 0

Answer: Following code is in python

n=input()

num='1'

while int(num)<=int(n):    //loop from 1 to n

   flag=1   //if an unequal element will be found it will be 0

   l=len(num)

   if num[0]=='3':

       j=0

       k=l-1

       while j<k:    //loop till middle of number

           if num[j]==num[k]:

               j+=1     //from beginning

               k-=1    //from end

           else:

               flag=0

               break

       if flag==1:

           print(int(num))

   num=str(int(num)+1)    //number will be incremented as integer

INPUT :

1000

OUTPUT :

3

33

303

313

323

333

343

353

363

373

383

393

Explanation:

In the above code, a loop is executed till num is equal to n which is entered by the user. num is treated as a string so that to ease the process of checking first character is 3 or not. If it is 3 then another loop executes which checks if an element from starting is equal to the corresponding element from the end. If an element is not equal then the flag is changed and then we break out of the loop and prints the number if the flag isn't changed.

You might be interested in
What is one step taken when solving a computer software problem?
k0ka [10]
Properly scanning the computer and deleting any viruse. this is Answer

Some of the feedback I hear from new developers working on a programming problem revolves around uncertainty of where to start. You understand the problem, the logic, basics of the syntax, etc. If you see someone else’s code or have someone to guide you, you can follow along. But maybe you feel uncertain about doing it yourself and have trouble turning your thoughts into code at first even though you understand the syntax or logic. Here’s my process and some tips to tackling a sample problem that hopefully some of you may find helpful in your journey.
HOME







Some of the feedback I hear from new developers working on a programming problem revolves around uncertainty of where to start. You understand the problem, the logic, basics of the syntax, etc. If you see someone else’s code or have someone to guide you, you can follow along. But maybe you feel uncertain about doing it yourself and have trouble turning your thoughts into code at first even though you understand the syntax or logic. Here’s my process and some tips to tackling a sample problem that hopefully some of you may find helpful in your journey.


3 0
3 years ago
Read 2 more answers
Virus infections often disable antivirus programs and prevent them from being enabled
SCORPION-xisa [38]
Some of the advanced viruses do this. So it would be true.
3 0
3 years ago
All the read/write heads a hard disk are controlled by a(n) ____ which moves the read/write heads across the disk surfaces in un
Maru [420]

Answer:  b. actuator

Explanation:

We know that a RW head ( or also known as read/write head) is a component of device which is usually appeared on the hard drive which is used to read and write data by the hard drive's disk . When data required to be read or write, the read/write arm is regulated by actuator.

[An actuator is a part of a device that is mainly responsible for moving and controlling a mechanism or system.]

Hence, All the read/write heads a hard disk are controlled by an actuator .

5 0
2 years ago
Which statement is true?
Klio2033 [76]

Answer:

You need to import the deque methods in order to use a deque.

Explanation:

the correct option is B

You need to import the deque methods in order to use a deque.

Please mark me as brainliest

5 0
3 years ago
Read 2 more answers
Which of the strategies below are likely to increase audience attention?
lbvjy [14]

Answer:

Vary the use of transitions for each slide

Explanation:

6 0
3 years ago
Other questions:
  • _____ is a web application server that provides the ability to connect web servers to multiple data sources.
    9·1 answer
  • Why is it important to verify a customer complaint?
    6·1 answer
  • What is VoIP?
    5·1 answer
  • What are the four types of technical drawing?​
    9·1 answer
  • Which one of the following pieces of information would be allowed as part of a limited data set?
    15·1 answer
  • Seeing an error message on the screen after you click on a link or icon may indicate that your PC doesn't have the correct _____
    15·1 answer
  • What is an orthochromatic film?
    12·1 answer
  • Similarities between inline css and internal css​
    6·1 answer
  • . Write at least three benefits of using a network.​
    8·1 answer
  • Const x = 0;
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!