subject

#include <iostream> using namespace std;

int main()
{
int num1, num2,r, i;

cout<<"Enter a start: ";
cin>>num1;
cout<<"Enter an end: ";
cin>>num2;
cout<<"\n\nODD NUMBERS\n";

for(i=num1; i<=num2; i++){
r=i%2;
if(r==1)
cout<<" "<<i;

}
cout<<"\nEVEN NUMBERS\n";

for(i=num1; i<=num2; i++){
r=i%2;
if(r==0)
cout<<" "<<i;
}
if(num1>num2){
cout<<"ERROR! Starting Number is GREATER THAN the Ending Number!!!";
return 0;
}
}

Using while loop, do while and for loop write a C++ program that lets you input a starting and ending integer (range) then display all the odd integers and the even integers within the range then compute the sum of each set of integers.:

If the starting number is greater than ending number, the program should display “ERROR! Starting Number is GREATER THAN the Ending Number!!!”.

Sample output:

Enter a start: 1

Enter an end: 10

ODD NUMBERS

1 3 5 7 9 Sum: 25

EVEN NUMBERS

2 4 6 8 10 Sum: 30

the attached pic has been my progress so far. please help me reach the expected output.


#include <iostream>

using namespace std;int main(){ int num1, num2,r,i; cout<<Enter

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 10:00
Create a word problem that involves calculating the volume and surface area of a three-dimensional object. cube: surface area 6 s2 , volume s3
Answers: 3
question
Computers and Technology, 22.06.2019 14:30
What percentage of companies is projected to use social media to locate new employees in 2012
Answers: 2
question
Computers and Technology, 23.06.2019 02:30
These factors limit the ability to attach files to e-mail messages. location of sender recipient's ability to open file size of file type of operating system used
Answers: 2
question
Computers and Technology, 24.06.2019 02:00
Read the following scenario, and then answer the question below. you want to send an e-mail to your boss requesting a meeting to discuss a raise. what is the best example of an e-mail to an employer about this meeting? “hey jason. can we chat about getting me more money soon? let me know. peace, meg.” “hello jason. pardon me for sending yet another e-mail today about my need to talk to you about my position and a possible pay increase. i am dying to know when you can talk. sincerely, meg.” “hello jason. i have been with the company for one year and have taken on more responsibilities than outlined in my job description. i would appreciate an opportunity to speak with you about my position. let me know when we can schedule a meeting. you, meg.” “greetings jason! i hope this e-mail finds you well and happy today. i really, really want to talk to you about something important. i am not sure if you have time. i hope you do. get back in touch with me and let me know when we might talk. ever so much for taking the time to read this. sincerely, meg.”
Answers: 3
You know the right answer?
#include <iostream> using namespace std;

int main()
{
int num1, num2,r...
Questions
question
Geography, 10.11.2020 04:40
question
Mathematics, 10.11.2020 04:40
question
Mathematics, 10.11.2020 04:40
question
Mathematics, 10.11.2020 04:40
question
Mathematics, 10.11.2020 04:40
Questions on the website: 13722367