Write the code for this assembly program?

Asked By 30 points N/A Posted on -
qa-featured

Write a program, which should prompt the user to enter a digit from 0 to 9
and store the input in some variable.
Now, prompt the user to enter another digit in given range.
You have to find the range of the next given number such that the sum of user-given numbers should not exceed 9.
Example:
Enter a number from  0 to 9: 5
Enter a number from  0  to 4: 3
Sum is: 8

SHARE
Best Answer by mdebuque
Best Answer
Best Answer
Answered By 0 points N/A #95871

Write the code for this assembly program?

qa-featured

This would be that program or code that you will be using for this:

#include <iostream>

using namespace std;

int main()

{

int num1, num2, sum;

cout << "Enter a number from 0-9:" << endl;

cin>>num1;

cout << "Enter a number from 0-5:" << endl;

cin>>num2;

sum=num1+num2;

cout<<"The sum is:"<<sum<<endl;

return 0;

}

Hope this will be of great help to you.

Answered By 0 points N/A #95872

Write the code for this assembly program?

qa-featured

It is a programming assignment and it can be easily solved by someone who is a programmer. Here is a simple solution to your problem.

#include <iostream>

using namespace std;

int main()

{

int num1, num2, sum;

cout << "Enter a number from 0 to 9:" ;

cin>>num1;

cout << "Enter a number from 0 to 5:" ;

cin>>num2;

sum=num1+num2;

cout<<"The sum is:"<<sum<<endl;

return 0;

}

The output of the program will be such that:

Related Questions