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
alexandr402 [8]
3 years ago
7

5. Create a function named second_a that uses a list comprehension. The function will take a single integer parameter n. Find ev

ery number from 1 to n (inclusive) that is a palindrome which starts with the digit 3. Do not user a helper function.
Engineering
1 answer:
Mekhanik [1.2K]3 years ago
8 0

Answer:

//Program was implemented using C++ Programming Language

// Comments are used for explanatory purpose

#include<iostream>

using namespace std;

unsigned int second_a(unsigned int n)

{

int r,sum=0,temp;

int first;

for(int i= 1; I<=n; i++)

{

first = n;

//Check if first digit is 3

// Remove last digit from number till only one digit is left

while(first >= 10)

{

first = first / 10;

}

if(first == 3) // if first digit is 3

{

//Check if n is palindrome

temp=n; // save the value of n in a temporary Variable

while(n>0)

{

r=n%10; //getting remainder

sum=(sum*10)+r;

n=n/10;

}

if(temp==sum)

cout<<n<<" is a palindrome";

else

cout<<n<<" is not a palindrome";

}

}

}

Explanation:

The above code segments is a functional program that checks if a number that starts with digit 3 is Palindromic or not.

The program was coded using C++ programming language.

The main method of the program is omitted.

Comments were used for explanatory purpose.

You might be interested in
The base class Pet has attributes name and age. The derived class Dog inherits attributes from the base class Pet class and incl
Nonamiya [84]

Answer:

Explanation:

class Pet:

   def __init__(self):

       self.name = ''

       self.age = 0

   def print_info(self):

       print('Pet Information:')

       print('   Name:', self.name)

       print('   Age:', self.age)

class Dog(Pet):

   def __init__(self):

       Pet.__init__(self)

       self.breed = ''

def main():

   my_pet = Pet()

   my_dog = Dog()

   pet_name = input()

   pet_age = int(input())

   dog_name = input()

   dog_age = int(input())

   dog_breed = input()

   my_pet.name = pet_name

   my_pet.age = pet_age

   my_pet.print_info()

   my_dog.name = dog_name

   my_dog.age = dog_age

   my_dog.breed = dog_breed

   my_dog.print_info()

   print('   Breed:', my_dog.breed)

main()

3 0
3 years ago
What is an example of a class 2 lever?
9966 [12]

Answer:

A wheelbarrow, a bottle opener, and an oar are examples of second class levers

6 0
2 years ago
Read 2 more answers
Gold forms a substitutional solid solution with silver. Compute the number of gold atoms per cubic centimeter for a silver-gold
evablogger [386]

Answer:

Compute the number of gold atoms per cubic centimeter = 9.052 x 10^21 atoms/cm3

Explanation:

The step by step and appropriate substitution is as shown in the attachment.

From number of moles = Concentration x volume

number of moles = number of particles/ Avogadro's number

Volume = mass/density, the appropriate derivation to get the number of moles of atoms

5 0
3 years ago
What components are included in a basic engine block?
atroni [7]
Houses the CYLINDERS, Water Jacket & Crankcase
8 0
2 years ago
If the channel-Length modulation effect is neglected, ID in the saturation region is considered to be independent of VDS
djverab [1.8K]
The answer is true because if the effect is neglected, the saturation id region is considered true
4 0
3 years ago
Other questions:
  • Pressurized steam at 450 K flows through a long, thin-walled pipe of 0.5-m diameter. The pipe is enclosed in a concrete casing t
    15·1 answer
  • What is productivity as it relates to labor?
    11·1 answer
  • What is an ip<br> Number
    12·1 answer
  • Define the hydraulic diameter for a rectangular duct
    7·1 answer
  • The manufacturer of a 1.5 V D flashlight battery says that the battery will deliver 9 mA for 40 continuous hours. During that ti
    11·1 answer
  • // This program accepts data about 100 books and// determines a price for each.// The price is 10 cents per page for the// first
    12·1 answer
  • A landowner and a contractor entered into a written contract under which the contractor agreed to build a building and pave an a
    14·1 answer
  • 8. Find the volume of the figure shown below: * V=L x W x H 7 cm 2 cm 2 cm​
    9·1 answer
  • Which cod is the best whoever has the best awnser gets brainliest​
    12·1 answer
  • 9. A piece of Cherry wood is 5/4 x 4" X 4'<br> What is the length in inches?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!