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
A flow field is characterized by the stream function ψ= 3x2y−y3. Demonstrate thatthe flow field represents a two-dimensional inc
boyakko [2]

Answer:

δu/δx+δu/δy = 6x-6x =0

9r^2

Explanation:

The flow is obviously two-dimensional, since the stream function depends only on the x and y coordinate. We can find the x and y velocity components by using the following relations:  

u =δψ/δy = 3x^2-3y^2

v =-δψ/δx = -6xy

Now, since:  

δu/δx+δu/δy = 6x-6x =0

we conclude that this flow satisfies the continuity equation for a 2D incompressible flow. Therefore, the flow is indeed a two-dimensional incompressible one.  

The magnitude of velocity is given by:  

|V| = u^2+v^2

    =(3x^2-3y^2)^2+(-6xy)^2

    =9x^4+18x^2y^2+9y^2

    =(3x^2+3y^2)^2

    =9r^2

where r is the distance from the origin of the coordinates, and we have used that r^2 = x^2 + y^2.  

The streamline ψ = 2 is given by the following equation:  

3x^2y — y^3 = 2,

which is most easily plotted by solving it for x:  

x =±√2-y^3/y

Plot of the streamline is given in the graph below.  

Explanation for the plot: the two x(y) functions (with minus and plus signs) given in the equation above were plotted as functions of y, after which the graph was rotated to obtain a standard coordinate diagram. The "+" and "-" parts are given in different colors, but keep in mind that these are actually "parts" of the same streamline.  

8 0
4 years ago
Question in Probability and Statistics 2<br>​
Ghella [55]
Since we both have a question in same subject may u help me with this For a confidence level of 80% with a sample size of 21, find the critical t value
7 0
3 years ago
Exercise 19
musickatia [10]
Uhh idk this can u mabye look it up
6 0
3 years ago
How do I draw this from the side?
tangare [24]

Answer:

draw it 3D

Explanation:

because it's a 3D picture

6 0
3 years ago
Is a street the same as a avenue
-BARSIC- [3]

they're essentially the same thing so i'd say yes

5 0
3 years ago
Read 2 more answers
Other questions:
  • Write down a transfer function of a stable system for which pure proportional feedback could drive the system unstable.
    11·1 answer
  • Show 2 reasons each on how Netflix shows a humane design and an addictive design.
    10·1 answer
  • Presence of beach marks on a fracture surface indicates a fatigue failure mode. a)-True b)- False
    5·1 answer
  • The cylindrical aluminum air tank below is to be rated for 300 psi and it must comply with the ASME Boiler Code which requires a
    5·2 answers
  • What sub-discipline of Mechanical Engineering focuses
    10·1 answer
  • At high altitude air temperature is low and ice formation on wings can cause serious issues for air crafts.A solution to this pr
    5·1 answer
  • The relationship between the pressure drop per unit length along a smooth-walled, horizontal microfluidic channel and the variab
    6·1 answer
  • The gross weight of a two-place Piper Cherokee is 2000lb and its wing area is 160 ft^2. What is its wing loading
    14·1 answer
  • Select the correct text in the passage.
    6·2 answers
  • An air-standard Diesel cycle engine operates as follows: The temperatures at the beginning and end of the compression stroke are
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!