in C++ CS121 Lab 6 March 29, 2019 Write a program that will ask the user to enter 2 integers, with the first less than the second. If the first is not less that the second, display a message. The program will then check all the integers between the 2 numbers (inclusive) to see if they are divisible by 3, 4, 5, and 6, and if so, display a message It will then ask if they want to go again, and if so, repeat the process.
code:-
#include <iostream>
using namespace std;
int main()
{
int num1,num2;
char repeater = 't';// to check that user wants
to go again or not.
while(repeater=='t')
{
cout<<"Enter two integers and first number
should be greater than second "<<endl;
cin>>num1>>num2;
char checker = 'f';//to check that user has
enter first number greater than second
while(checker=='f')
{
if(num1>num2)
checker='t';
else
{
cout<<"\nsecond number entered is greater than first
number.\nplease enter the which is smaller than
"<<num1<<endl;
cin>>num2;
}
}
int i;//for loop counter
for(i=num2; i<=num1; i++)
{
if(i%3==0)
cout<<"\n"<<i<<" which is between
"<<num1<<" and "<<num2<<" is divisible by
3"<<endl;
if(i%4==0)
cout<<"\n"<<i<<" which is between
"<<num1<<" and "<<num2<<" is divisible by
4"<<endl;
if(i%5==0)
cout<<"\n"<<i<<" which is between
"<<num1<<" and "<<num2<<" is divisible by
5"<<endl;
if(i%6==0)
cout<<"\n"<<i<<" which is between
"<<num1<<" and "<<num2<<" is divisible by
6"<<endl;
}
cout<<"\nEnter character t to continue
:";
cin>>repeater;
if(repeater!='t')
cout<<"\nThanks
for using this program"<<endl;
}
return 0;
}
output:-

in C++ CS121 Lab 6 March 29, 2019 Write a program that will ask the user...
1. Write a program to add positive numbers. Ask the user to enter numbers greater than zero. If a 0, is entered stop requesting numbers and display the total. If a number is entered that is less than 0, display the message ‘Number must be greater than 0’, then ask for another number to be entered. Repeat until a number greater than 0 or 0 is entered. use math lab so I can copy the answers
Summary: Write a C program that prompts the user to enter 2 positive integer numbers, display the numbers in 3 formats. Then check, whether the larger of the 2 is evenly divisible by the smaller. Detail: Write a complete C program, more complex than the typical "hello world" program. Prompt the user to enter 2 integer numbers that are not negative. After either entry, display that number again. Print the smaller in hexadecimal, in decimal, and in octal format. Include...
For Java - Write a program that creates an array of 10 integers. Ask the user to enter the subscript (index) of an element, then displays the element located at that subscript. If the subscript entered is out of bounds (less than 0 or greater than length - 1), display the message "Out of Bounds".
Write a complete C++ program to ask the user to inter two
integers and the program finds and display the greatest common
divisor (GCD) of the two integers. Typical output screen should be
as following:
Write a complete C++ program to ask the user to inter two integers and the program finds and display the greatest common divisor (GCD) of the two integers. Typical output screen should be as following: Enter two integers 18 27 The GCD is = 9
write a program that asks the user to enter two integers one at a time if the first value is not an integer then do not ask for a second then display both values otherwise print error message stating which value entered was not an integer python
Create two java programs. The first will ask the user to enter three integers. Once the three integers are entered, ask the user to enter one of three functions. The “average” if they want the average of the three numbers entered, enter “min” if they want the minimum and “max” if they want the maximum. Display the answer. Ask the user if they want to calculate another function for the three numbers. If so, loop and ask what function they...
1. (sumFrom1.cpp) Write a program that will ask the user for a positive integer value. The program should use the for loop to get the sum of all the integers from 1 up to the number entered. For example, if the user enters 50, the loop will find the sum of 1, 2, 3, 4, ... 50. If the user enters a zero or negative number, a message should be given and the program should not continue (see Sample Run...
RandomGame.cpp (2pt) Write a program that asks the user to enter his/her name. Then begin a do while loop that asks the user to enter a number between 1 and 10. Have the random number generator produce a number 1 and 10. Display the user’s name and both numbers to the screen. Compare the two numbers and report if the entered number is greater than, less than, or the same as the generated number. Ask the user if he/she’d like...
For this lab, write a program that lets the user enter a state and the program returns that state's capital, stored in a dictionary Requirements: Start by hard coding in all of the states and their capitals the user should be able to enter the name of a state or ask for all states to be printed (one key/value pair per line) If the state is in the dictionary, print its state capital in the form: "The capital of Vermont...
use C++ to write the following program.
needs to ask the user for n
The user must put in those 5 values, probably using a for
loop.
NOTE: You can assume the number of values to be entered is
5.
My attempted program below: (not correct, but just a basis)
4. Larger Than n In a program, write a function that accepts three arguments: an array, the size of the array, and a number n. Assume that the array contains...