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]
3 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]3 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
Will Mark the brainliest
Sonbull [250]

Answer:

computer

Explanation:

By typing and answer and keep the data and have files

4 0
3 years ago
Write the pseudocode for the following:
Marta_Voda [28]
Answer: A


Explanation:
5 0
4 years ago
Provide an example of a question that could NOT be answered with a binary message. Explain why this is the case, making referenc
solong [7]
This is a question with a much simpler answer given its open ended ness - a representation merely means, given binary data, we can determine what 'thing' that binary data corresponds to.

<span>That makes the question unanswerable, because words can all be represented in binary data, and the question cannot be answered without those. Thus, all answers we can convey have a binary representation of some form (that form being the translation of the words we used to communicate the answer into binary data).</span>
7 0
4 years ago
Assume the availability of a function is_prime. Assume a variable n has been associated with positive integer. Write the stateme
My name is Ann [436]

Answer:

def main():

   # Accept data from the user

   n=int(input('Enter the value of n:'))

   k=2;

   sum=0

   print('The list of the prime numbers are as follows:')

   # This loop runs from k to n

   while k<=n:

       # Call is_prime() method,

       # to check whether k is a prime or not

       sum=sum+is_prime(k)

       k=k+1

   print('Sum of the prime numbers:',sum)

# is_prime() Method

def is_prime(k):

   prime=0        

   i=1

   # Check k is a prime or not

   while i<=int(k):

       # Find the factors of k

       if (k % i) == 0:

           prime=prime+1

       i=i+1

   # If k as two factors

   if(prime==2):        

       print(k)

       return k;

   # If k as more than two factors

   else:        

       return 0;

# Call the main() method

main()

Explanation:

5 0
3 years ago
Which of the following memories would NOT be an example of long-term memory? a. acknowledging that you just sat down b. remember
Sati [7]

Answer: the following memories would NOT be an example of long-term memory are the letter  a) and c)

<em> -acknowledging that you just sat down </em>

-recollecting what you had for breakfast an hour ago

Explanation:

as the Long-term memory, also called inactive memory or secondary memory, is a type of memory that stores memories for a period of time greater than five o six months

6 0
4 years ago
Other questions:
  • Charges of the opposite tend to repel each other.
    9·2 answers
  • If the task is to write firewall specifications for the preparation of a(n) ____, the planner would note that the deliverable is
    14·1 answer
  • What is value parameter and reference parameter while things are passed by Also, do a c code to show it
    13·1 answer
  • What additional information could you add to a sketch to provide other team members with a more accurate design drawing?
    9·1 answer
  • What is the function of napier's bones<br>​
    8·1 answer
  • Which of the following letters do the most reliable websites end in?
    12·2 answers
  • Organizational Units are typically configured to: prevent companies from sharing resources. ensure that the system password is t
    13·1 answer
  • Software refers to the physical parts of a computer.<br> a. True<br> b. False
    11·2 answers
  • What internal commands can we use when in interactive mode? can we use CLS and CD?
    6·1 answer
  • Pls answer dis question when i'm not connected and i open bluestacks 5 it will be working but if i am connected it wil not work
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!