2. Write a Marie program that accepts two positive (inputs) two integers and outputs the sum of both of the integers and all the numbers in between
Write a Marie program that determines the largest of a series of positive integers provided by a user. The user will enter a -1 when she is finished. Up to 10 numbers will be provided by the user.
Write a Marie program that accepts two positive integers, multiples them by repeated addition, and outputs the result.
Write a Marie program that accepts 4 positive integers and outputs them in ascending order.
Write a Marie program of 40 lines or less that accepts 15 positive integers and outputs the maximum number that was provided by the user. You need to use a loop to input the numbers and determine the max value.
#include<iostream>
using namespace std;
int getnum(string mess,int[]);
int add(int [], int [],int[] ,int,int);
void print(int a[],int);
bool checkinput(string);
int main()
{int a[21];
int b[21];
int c[51];
int i, lena,lenb,lenc;
lena=getnum("first number: ",a);
cout<<endl;
lenb=getnum("second number: ",b);
lenc=add(a,b,c,lena,lenb);
cout<<" ";
print(a,lena);
cout<<"+ ";
print(b,lenb);
for(i=0;i<lenc+5;i++)
cout<<"-";
cout<<"\n ";
print(c,lenc);
system("pause");
return 0;
}
bool checkinput(string in)
{int i;
if(in.length()>20)
return false;
for(i=0;i<in.length();i++)
if(in[i]<'0'||in[i]>'9')
{cout<<"invalid input\n";
return
false;
}
return true;
}
int getnum(string mess,int a[])
{int i;
for(i=0;i<21;i++)
a[i]=0;
string input;
cout<<"Enter "<<mess;
cin>>input;
while(!checkinput(input))
{cout<<"Enter "<<mess;
cin>>input;
}
for(i=0;i<input.length();i++)
a[input.length()-1-i]=input[i]-'0';
return input.length();
}
int add(int a[], int b[],int c[],int lena,int lenb)
{int i,n,carry=0,d;
cout<<endl;
for(i=0;i<21;i++)
c[i]=0;
if(lena>lenb)
n=lena;
else
n=lenb;
for(i=0;i<n;i++)
{d=a[i]+b[i]+carry;
c[i]=d%10;
carry=d/10;
}
if(carry==0)
return n;
else
c[i]=carry;
return n+1;
}
void print(int a[],int len)
{int i;
for(i=len-1;i>=0;i--)
cout<<a[i];
cout<<endl;
}
2. Write a Marie program that accepts two positive (inputs) two integers and outputs the sum...
Write MARIE assembly language programs that do the following: I. Write a program that inputs three integers, a, b, and c, in that order. It computes the following ia-bi-fc+ c The result should be written to output 2. Write a program that inputs integers, s. y, and z. It outputs the difference of the langest and first element entered. You may assume x. y, and z all have different values. So if 8, 12, and 9 are input, the output...
textbook solution does not appear correct. Write a MARIE program using a loop that multiplies two positive numbers by using repeated addition. For example, to multiply 3 × 6, the program would add 3 six times, or 3 + 3 + 3 + 3 + 3 + 3.
Please help C++ language Instructions Write a program that prompts the user to enter 50 integers and stores them in an array. The program then determines and outputs which numbers in the array are sum of two other array elements. If an array element is the sum of two other array elements, then for this array element, the program should output all such pairs.
c++ no pointers just follow instructions Write a program (array.cpp) that read positive floating point numbers into an array of capacity 100. The program will then ask for one of three letters(A, M or S). if the user inputs something other than one of these letters, then the program should ask for that input until an A, M, or S is entered. A do-while loop should be used for this. If the user inputs an A, then the program should...
In C++: Write a program that reads a list of integers, and outputs the two smallest integers in the list, in ascending order. The list is preceded by an integer indicating how many numbers are in the list. If the input is: 5 10 5 3 21 2, the output is: 2 3 To achieve the above, first read the integers into a vector.
JAVA. Write a program that reads in a series of positive integers and prints out the maximum value entered. The user will indicate they are finished entering numbers by entering zero or a negative integer.
Write a java program that asks the user to enter 2 integers, obtains them from the user, determines if they are even or odd numbers and prints their sum, product, difference, and quotient (Division).
find the inputs and outputs, create the pseudocode, and desk check Write a program that will add up the sum of a series of numbers starting at 1 up to the number entered as in 1 + 2 + 3 + 4 + 5 = 15, where 5 was the number entered.
Write a program to compute the product of two positive integers by repeated addition. Note: You are not allowed to use either multiplication or division operator. Understanding the Meaning of Multiplication: Multiplication of whole numbers can be thought of as repeated addition. // not allowed to use multiplication or division operator For example, suppose that a parking lot has 6 rows of parking spaces with 8 spaces in each row. How many parking spaces are in the lot? rows To...
Write a program that prompts the user for two integers and then prints The sum The difference The product The average The distance (absolute value of the difference) The maximum (the larger of the two) The minimum (the smaller of the two) hint: python defines max and min functions that accept a sequence of values, each separated with a comma. **program must be written in Python**