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 the code to call the function named send_signal. there are no parameters for this function.
nikklg [1K]

<em>*Assuming JavaScript</em>

Answer:

function send_signal() {}

send_signal() // calls the function

Explanation:

3 0
3 years ago
You can protect yourself from identity theft by using ____ when transmitting information over network connections. a. cookies b.
Yakvenalex [24]

Answer:

D

Explanation:

Encryption secures transmissions on the internet to or from your PC

5 0
3 years ago
How can you tell if a website is secure
OLga [1]
Check the SSL Certificate. Look at the URL of the website. If it begins with “https” instead of “http” it means the site is secured using an SSL Certificate (the s stands for secure). SSL Certificates secure all of your data as it is passed from your browser to the website's server.
4 0
3 years ago
Write three statements to print the first three elements of array runTimes. Follow each statement with a newline. Ex: If runTime
Sidana [21]

Answer:

Following are the code in the Java Programming Language.

//print first element of the array

System.out.println(runTimes[0]);

//Print second element of the array

System.out.println(runTimes[1]);

//print third element of the array

System.out.println(runTimes[2]);

Explanation:

<u>Following are the description of the Program</u>:

In the above program, There is the integer type array variable that is 'runTimes' and its index value is 5. Then, initialize values in the array one by one which means firstly, they insert in index 0, then in index 1, and so on. Finally, we have to print the first three elements of the array. So, we set the System.out.println() function three times to print array by passing array name and first three index value with it.

3 0
3 years ago
How is knowing how to use word or docs importamt?
ollegr [7]
For 90% of users, the word processing capabilities of Google Docs is more than enough. But for some, Microsoft Word's advanced features will be important. ... You also get far more powerful templates, which could speed up your work, depending on what you use Word for.
3 0
3 years ago
Other questions:
  • What is a project manager?
    6·2 answers
  • How many service packs did windows 7 have?
    9·1 answer
  • Whenever I go onto Google Chrome, the words are in Spanish! How can I make the words be back in English again? Please let me kno
    7·1 answer
  • What systemctl command configures a unit to start the next time the computer boots?
    10·1 answer
  • Artie believes that all Asian people are more intelligent than other people. Artie is engaging in?
    12·2 answers
  • Whichof following can be thrown using the throw statement?ErrorThrowableExceptionRuntimeExceptionAll of Given
    14·1 answer
  • A photograph with more yellows has which mood
    6·2 answers
  • Need help with these
    8·1 answer
  • PLEASE HELP 15 POINTS; JAVASCRIPT
    10·1 answer
  • The ___________ method returns the length of an array.
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!