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
Gps receivers are commonly used by individuals to determine their geographic location while hiking and to obtain driving directi
soldier1979 [14.2K]
I think it is true also.
7 0
3 years ago
What do you think about Naruto?
Natalka [10]

Answer:

AMAZINGGG

Explanation:

because it just is !!

3 0
2 years ago
Read 2 more answers
A communication sent through Transmission Control Protocol (TCP) arrives out of order. What allows the data to be put back toget
algol13

Answer:

Error detection.

Explanation:

Tcp is a transport layer protocol. It is said to be connection oriented because it requires a handshake or established connection between the sender and the receiver.

Once a handshake is made, the segments of the packets are sent across and the connection is closed.

The error detection does not only carry out integrity checks, but allows for sequence numbering from the sender to receiver. If the packets arrives out of order, the sequence numbers are used to arrange them in the correct order.

5 0
3 years ago
Enrico waited ten years to file a cause of action against Frederico for a breach of contract claim. Frederico can use ______ as
ser-zykov [4K]
Time, due to the amount of time between the initial action and the filing of the report, federico could claim the it didn't happen or something
3 0
3 years ago
What is the final amount stored in value if the computer selects 17 as the
nadya68 [22]

Answer: -17

Explanation:

Our random number is 17. Let's go through line by line.

  1. value is a random number picked which is 17
  2. valueB = 17 / 2 = 8.5
  3. If value is greater than 0 AND value has a remainder of 1, we will set the value to value* -1.
  4. Value is now 17 * -1 = -17

Let's quickly calculate value mod 2. 17 % 2 = is 1. If you're wondering how we did that, the remainder after dividing 8 into 17 twice is 1, because 17 - 16 = 1.

We stop after line 4 because we stop the conditional statement after one condition is filled.

6 0
3 years ago
Other questions:
  • Henry has to create software that manages a database of all his clients of his firm. He wishes to run software on another comput
    10·2 answers
  • In the range C15:G15, insert a function to calculate the total daily revenue. In the range H11:H15, insert a function to calcula
    8·1 answer
  • Prevent a page break in the final paragraph of this document by keeping the lines together
    10·1 answer
  • "assignment is to create a program that will read a value from an array, and then place this value in another array with the loc
    10·1 answer
  • Suppose you have an int variable called number. What Java expression produces the second-to-last digit of the number (the 10s pl
    15·1 answer
  • Courts are struggling with the privacy implications of GPStracking. In 2009, New York’s highest court held that policeofficers m
    8·1 answer
  • The photographer for "The Migrant Mother" photograph used _______________, which is a technique that would be considered unethic
    8·2 answers
  • Suppose a webpage contains a single text field. We want to make the page such that a user can immediately start typing in the te
    11·1 answer
  • New and just need help with C coding. I've tried if statements and it outputs the wrong number.
    6·2 answers
  • A computer is defined by 4 specific criteri. Select all 4.*
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!