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
White raven [17]
2 years ago
15

Write a recursive function that returns true if the digits of a positive integer are in increasing order; otherwise, the functio

n returns false. Also, write a program to test your function.

Computers and Technology
1 answer:
deff fn [24]2 years ago
4 0

Answer:

C code implementing the function:

#include<stdio.h>

int isIncreasing(int m);

void main()

{

int y, t;

 

printf("Enter any positive integer: ");  

scanf("%d", &y);

 

t= isIncreasing(y); //call the functoion isIncreasing(int m)  

 

if(t==1) //if isIncreasing(int m) returns 1, then the digits are in //increasing order

 printf("True:  The digits are in increasing order");

else

 printf("False:  The digits are not in increasing order");

}

int isIncreasing(int m)

{

int d1,d2;

if(m/10==0) //if we reach till the left of left most digit, then all before  //digits were in order. else it won't go upto that.

{

 return 1;

}

d1 = m%10; //d1 holds the right most digit of current m.

if(m%10 !=0)

{

 m = m/10; //m is updated to find the rest digits and compare //them.

 d2 = m%10;//d2 holds the digit just left of the right most digit of //m.

 if(d2 <= d1) // if the right most and it's left digits are in order then //we proceed to left.

 {

  isIncreasing(m);

 }

 else   //else we stop there itself, no need to move further.

  return 0;

}

}

output is given as image.

You might be interested in
In what software development model does activity progress in a lock-step sequential process where no phase begins until the prev
den301095 [7]

Answer:

"Waterfall" is the correct answer for the above question.

Explanation:

  • The Waterfall model is a model which is the first model recognized by some scientists is used to states some rules to develop the software. It is based on the phases of the SDLC. The SDLC is the collection of phase that is used in software development.
  • The waterfall model moves like water moves. It means any next phase starts if the previous phase is completed and the user can not move into previous steps of the model.
  • This is also asked by the question. Hence the answer is the waterfall model.
5 0
3 years ago
Digital subscriber lines: are very-high-speed data lines typically leased from long-distance telephone companies. are assigned t
V125BC [204]

Answer: Operate over existing telephone lines to carry voice, data, and video.

Explanation:

Digital subscriber line is a means of transferring high bandwidth data over a telephone line. Such data could be a voice call, graphics or video conferencing. DSL uses a user's existing land lines in a subscriber's home, allowing users to talk on a telephone line while also being connected to the Internet. In most cases, the DSL speed is a function of the distance between a user and a central station. The closer the station, the better its connectivity.

5 0
3 years ago
Mrs. Patel uses a computer program to balance her checkbook. Which of the following best explains how the
Alexandra [31]

Answer:

c it reduces errors

Explanation:

Instead of Mrs.Patel doing it she has an online program made for checks to do it for her.

6 0
3 years ago
In computing the present value of the lease payments, the lessee should a.use both its incremental borrowing rate and the implic
JulijaS [17]

Answer:

The answer is  "Option a"

Explanation:

This payment is equivalent to the regular rent formally specified by the same contract that grants the member the rights for a specified time. It used both the nominal lending rate and the lessor's conditional value,  which provides the lower implied rate, and wrong choices can be described as follows:

  • In option b, It is wrong because in this we assume the implicit rate is lessee.
  • Option c and Option d both were wrong because It doesn't use the Iterative credit rate.

6 0
3 years ago
What is full form of RAM??? ​
stepladder [879]

Answer:

Random Access Memory, it's used to store working data and machine codes

Explanation:

Hope it helped !
Adriel

7 0
2 years ago
Read 2 more answers
Other questions:
  • type the correct answer in the Box spell the words correctly Caleb is working on a simple logic base program to stimulate the ga
    5·2 answers
  • Theâ ______ is a large worldwide collection of networks that use a common protocol to communicate with one another.
    5·1 answer
  • A drowsy cat spots a flowerpot that sails first up and then down past an open window. The pot is in view for a total of 0.50 sec
    13·1 answer
  • Develop a list of privacy protection features that should be present if a website is serious about protecting privacy. Then, vis
    8·1 answer
  • Your search google for recipe for tonight dinner is an.example of ?​
    8·2 answers
  • What is a Hard Drive
    13·1 answer
  • 334. Universal Containers uses a custom field on the account object to capture the account credit status. The sales team wants t
    12·1 answer
  • Ashton assigned a string value to a variable. Which program statement should he use?
    5·1 answer
  • Write a C# program named ProjectedRaises that includes a named constant representing next year’s anticipated 4 percent raise for
    15·1 answer
  • One of 34 possible _________________ can be assigned to each axis of classification in the seven-character code.
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!