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
Type the correct answer in the box. Spell all words correctly.
sesenic [268]

Answer:

Chemical Engineers use chemistry, math and physics to design and use to make chemical products. The fibers in clothing are designed by chemical engineers.

6 0
3 years ago
Read 2 more answers
What flight patterns do groups of birds utilize and why?
lara31 [8.8K]
Birds mostly fly in a V because the lead bird cuts al of the wind and has the hardest work and then after a while the lead bird goes to the back and another bird takes his place cutting all the wind for the other birds
7 0
3 years ago
0 - 1"<br> -20<br> -15<br> -10<br> 5<br> 0 1 2 3<br> 0
faust18 [17]

Answer:

#WeirdestQuestionOfAllTime

Explanation:

8 0
3 years ago
A program contains the following function definition: int cube(int number) { return number * number * number; } Write a stateme
Nonamiya [84]

Answer:

The statement can be written as

int result = cube(4);

Explanation:

A function is a block of reusable codes to perform some tasks. For example, the function in the question is to calculate the cube of a number.

A function can also operate on one or more input value (argument) and return a result. The <em>cube </em>function in the question accept one input value through its parameter <em>number </em>and the <em>number</em> will be multiplied by itself twice and return the result.  

To call a function, just simply write the function name followed with parenthesis (e.g. <em>cube()</em>). Within the parenthesis, we can include zero or one or more than one values as argument(s) (e.g. <em>cube(4)</em>).

We can then use the "=" operator to assign the return output of the function to a variable (e.g. <em>int result = cube(4)</em>)

8 0
3 years ago
This search compares the target value with the middle element in the collection, then ignores the half of the collection in whic
love history [14]

Answer:

d) Binary

Explanation:

Binary search is a search algorithm that finds the position of a value in an ordered array. It compares the value with the element in the middle of the array, if they are not equal, half in which the value cannot be eliminated and the search continues in the remaining half until the value is found.

7 0
3 years ago
Other questions:
  • When a mesh in a circuit contains an independent or dependent current source, this leads to a special case of mesh-current analy
    14·1 answer
  • Not much of a question :/ dont answer
    9·1 answer
  • What is the main role of matrix in composites! a)-to transfer stress to the other phases b)- to protect phases from environment
    7·1 answer
  • Which of the following is an example of seeking accreditation?
    7·1 answer
  • What are the benefits of using a multi view sketch to communicate a design
    14·1 answer
  • Do you know who Candice is
    8·2 answers
  • 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
  • Describe a gear train that would transform a counterclockwise input rotation to a counterclockwise output rotation where the dri
    13·1 answer
  • Three bars each made of different materials are connected together and placed between two walls when the temperature is 12 oC. D
    9·1 answer
  • Which emission is created by the heat in the combustion process?
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!