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]
4 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]4 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
Write a line of code to create a constant called MAX that will hold the size of an array that can store up to 25 decimal values.
Valentin [98]

Answer:

A line of code to create a constant called MAX that will hold the size of an array that can store up to 25 decimal values. Separate each item with 1 space, and end the line with a semi-colon.

Here,

const int MAX = 25;

7 0
3 years ago
How do I get my text box to stop moving continuously on a Chromebook?
pickupchik [31]

Answer:

Go to Settings. Click on Advanced Settings. Scroll down to the Accessibility section. Make sure that the box next to “Automatically click when the mouse pointer stops” is Unchecked.

Explanation:

here you go hope this helps!!

5 0
3 years ago
Read 2 more answers
Sometimes a virus will disable a system’s antivirus protection or add exceptions which prevent its being detected. Running an an
nikklg [1K]

Answer:

A boot-up CD or a USB

Explanation:

6 0
3 years ago
I put 100 points in here
tatuchka [14]

Answer:

you only put 50 points not 100

4 0
3 years ago
Technician A says aluminum cylinder head surfaces should be scraped clean only with nonmetallic tools to avoid gouging. Technici
fredd [130]
<span><span><span /></span></span>Both Technicians (A and B) are correct since the aluminum cylinder head surfaces should be scraped clean only with nonmetallic tools to avoid gouging and it should also be chemically cleaned in accordance with the manufacturer's recommendations before the inspection.<span><span /></span>
6 0
3 years ago
Read 2 more answers
Other questions:
  • One type of technology that can verify a person's identity is _____.
    6·2 answers
  • FOR ALL PLATO USERS:
    10·2 answers
  • The benefit from dividing code into methods known as ________ is gained as follows: After you write code to perform a task once,
    14·1 answer
  • A network technician is designing a network for a small company. The network technician needs to implement an email server and w
    7·1 answer
  • What are the two basic classes of active directory objects?
    14·1 answer
  • Where are methods listed in a UML class diagram showing three parts?
    8·1 answer
  • Discuss the core technologies and provide examples of where they exist in society. Discuss how the core technologies are part of
    14·1 answer
  • Which technology will a business use to identify unauthorized access to intranet sites or files by its employees?
    13·1 answer
  • With
    10·2 answers
  • "write a program to play and score the paper-rock-scissor game. each of two users types in either p, r, or s. the program then a
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!