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
Which magazine introduced the first microcomputer kit for the mits altair in its january 1975 issue?
Tcecarenko [31]

Answer:

Popular Electronics  is the correct answer.

Explanation:

It is the first magazine that released in the year 1975, Jan. The following magazine is about the initial microcomputer kit which for the Mits Altair.

So, that's why the following answer is not false because it is the first magazine that released the article about the following microcomputer kit that is update on the cover of the magazine.

6 0
3 years ago
I need more friends plz talk with me
Bad White [126]

Answer:

hello hru??

Explanation:

<h2><em><u>PLEASE</u></em><em><u> MARK</u></em><em><u> ME</u></em><em><u> BRAINLIEST</u></em><em><u> AND</u></em><em><u> FOLLOW</u></em><em><u> ME</u></em><em><u> LOTS</u></em><em><u> OF</u></em><em><u> LOVE</u></em><em><u> FROM</u></em><em><u> MY</u></em><em><u> HEART</u></em><em><u> AND</u></em><em><u> SOUL</u></em><em><u> DARLING</u></em><em><u> TEJASWINI</u></em><em><u> SINHA</u></em><em><u> HERE</u></em><em><u> ❤️</u></em></h2>
6 0
2 years ago
Read 2 more answers
Cho dãy A gồm N số nguyên a1,...aN. Hãy đếm tất cả các số âm hoặc không chia hết cho 5 trong dãy
aleksandrvk [35]

Answer:

#include<iostream>

int main()

{

int count=0;

int so_phan_tu;

std::cout << "nhap so phan tu : \n";

std::cin >> so_phan_tu;

int* A = new int[so_phan_tu];

std::cout << "nhap cac phan tu : \n";

for (int i = 0; i < so_phan_tu; i++)

{

 std::cin >> A[i];

 if (A[i] % 5 == 0)

 {

  count++;

 }

}

std::cout << so_phan_tu - count;

system("pause");

return 0;

}

//cái này viết bằng C++ em nhé

Explanation:

3 0
2 years ago
Hey plz help me with this<br>What is malware short for?​
soldier1979 [14.2K]

Answer:

Malware is the collective name for a number of malicious software variants, including viruses, ransomware and spyware. Shorthand for malicious software, malware typically consists of code developed by cyberattackers.

Explanation:

4 0
2 years ago
Why is audio greyed out on powerpoint ms office 2011?
-BARSIC- [3]
Because its a old type of software and probably wont run on your computer
7 0
3 years ago
Other questions:
  • In steps<br> Urgent please
    14·1 answer
  • what is the primary way to access applications in windows 8? a. control panel b. start menu c. desktop tiles d. context menu
    7·1 answer
  • Which of the following roles is responsible for writing programming code?
    10·1 answer
  • What is the subnet mask ?
    9·2 answers
  • Write an expression to print each price in stock_prices. Sample output with inputs: 34.62 76.30 85.05
    9·1 answer
  • Send me the answers<br>​
    15·1 answer
  • Describe, with examples, the way in which a defect in software can cause harm to a person, to the environment, or to a company
    9·1 answer
  • Can you predict what changes will come to data storage in the next decade? 
    12·1 answer
  • In this paper https://arxiv.org/pdf/2008.10150.pdf, I'm having a hard time understanding how the assignment in the picture is de
    10·2 answers
  • The use of technology to observe a user's actions often without the user's knowledge is known as:
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!