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
vodka [1.7K]
3 years ago
9

Read two numbers on the keyboard. Display for each: how many digits it consists of, which is the sum of the digits, and which of

the two digits is greater.
it is in c++ help me fast pls
Computers and Technology
1 answer:
Fantom [35]3 years ago
6 0

Answer:

Here it is

Explanation:

#include <iostream>

using namespace std;

int main()

{

   int a, b;

   cin >> a >> b;

   int nr_digits1 = 0, nr_digits2 = 0;

   int sum1 = 0, sum2 = 0;

   int max_digit1 = 0, max_digit2 = 0;

   while (a > 1)

   {

       int digit = a % 10;

       nr_digits1 += 1;

       sum1 += digit;

       if (digit > max_digit1)

       {

           max_digit1 = digit;

       }

       a /= 10;

   }

   while (b > 1)

   {

       int digit = b % 10;

       nr_digits2 += 1;

       sum2 += digit;

       if (digit > max_digit2)

       {

           max_digit2 = digit;

       }

       b /= 10;

   }

   

   cout << "For a: \n" << "   No. of digits: " << nr_digits1 << "\n";

   cout << "   Sum of digits: " << sum1 << "\n";

   cout << "   Max digit: " << max_digit1 << "\n";

   cout << "\n";

   cout << "For b: \n" << "   No. of digits: " << nr_digits2 << "\n";

   cout << "   Sum of digits: " << sum2 << "\n";

   cout << "   Max digit: " << max_digit2 << "\n";

   return 0;

}

You might be interested in
Any device that uses light to read and write information.
Ilya [14]
I think Optical Drive does.
8 0
3 years ago
Read 2 more answers
Energy is required in order to produce any sound.<br> true<br> false
bazaltina [42]

True. Hope this helps! <3



8 0
3 years ago
Read 2 more answers
Why should teachers refrain from using extreme language, such as “I’m dying of hunger,” around four- and five-year-old children?
swat32

Answer:

Teachers of four and five year old children should refrain from using sentences such as "i'm dying of hunger," because children so young could take the death part of the comment to literally, they are small children, and do not yet fully understand the concept of figure of speech or over exaggeration.

3 0
3 years ago
Explain four sitting postures in a computer laboratory​
Flura [38]
1. Push hips back
2. Adjust seat
3. Sit up straight and roll your shoulders back
4. Feet flat on floor
8 0
3 years ago
Part1) Given 3 integers, output their average and their product, using integer arithmetic.
Mrac [35]

Answer:

The program is as follows:

#include <iostream>

#include <iomanip>

using namespace std;

int main(){

   int num1, num2, num3;

   cin>>num1>>num2>>num3;

   cout << fixed << setprecision(2);

   cout<<(num1 + num2 + num3)/3<<" ";

   cout<<num1 * num2 * num3<<" ";

   return 0;

}

Explanation:

This declares three integer variables

   int num1, num2, num3;

This gets input for the three integers

   cin>>num1>>num2>>num3;

This is used to set the precision to 2

   cout << fixed << setprecision(2);

This prints the average

   cout<<(num1 + num2 + num3)/3<<" ";

This prints the product

   cout<<num1 * num2 * num3<<" ";

6 0
4 years ago
Other questions:
  • What are the names of each devices pleaseee​
    13·2 answers
  • Which is the output of the formula =XOR(120&lt;102;83=83;51&lt;24)??
    11·2 answers
  • Which solution eliminates the need for dedicated high-speed WAN connections between sites
    11·1 answer
  • Please write down a java program for below instruction.Min-Heap: Construct a Min_Heap from the following set of integers. Rememb
    5·1 answer
  • Which of the following is not a reserved keyword in python?​
    13·1 answer
  • Ano ang dalawang paraan sa paggawa ng abono?​
    6·1 answer
  • Consider the following method.
    14·1 answer
  • What is the protocol for getting to the Web?
    9·2 answers
  • What does input allow a computer to do
    14·1 answer
  • What do you think is the most effective way to ensure that code adheres to good coding standards.
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!